Skip to content

Commit

Permalink
Faster map rendering when using null symbol renderer
Browse files Browse the repository at this point in the history
If we can skip the loop which fetches features altogether, let's do that
and save some time which would be otherwise spent getting geometries only
to delete them immediately afterwards.

This is practical especially for 3D scenes where it is useful
to set 2D renderer to null if 3D renderer is set.
  • Loading branch information
wonder-sk committed Jul 10, 2019
1 parent 818f996 commit 3f50615
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/qgsvectorlayerrenderer.cpp
Expand Up @@ -124,6 +124,14 @@ bool QgsVectorLayerRenderer::render()
return false;
}

if ( mRenderer->type() == QStringLiteral( "nullSymbol" ) )
{
// a little shortcut for the null symbol renderer - most of the time it is not going to render anything
// so we can even skip the whole loop to fetch features
if ( !mDrawVertexMarkers && !mLabelProvider && !mDiagramProvider && mSelectedFeatureIds.isEmpty() )
return true;
}

bool usingEffect = false;
if ( mRenderer->paintEffect() && mRenderer->paintEffect()->enabled() )
{
Expand Down

0 comments on commit 3f50615

Please sign in to comment.