Skip to content

Commit

Permalink
Inverted renderer: make sure it works when no painter is here (featur…
Browse files Browse the repository at this point in the history
…e count)
  • Loading branch information
Hugo Mercier committed May 26, 2014
1 parent 7906154 commit 19041a8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp
Expand Up @@ -73,6 +73,11 @@ void QgsInvertedPolygonRenderer::startRender( QgsRenderContext& context, const Q
// It must be computed in the destination CRS if reprojection is enabled.
const QgsMapToPixel& mtp( context.mapToPixel() );

if ( !context.painter() )
{
return;
}

// convert viewport to dest CRS
QRect e( context.painter()->viewport() );
// add some space to hide borders and tend to infinity
Expand Down Expand Up @@ -102,7 +107,10 @@ void QgsInvertedPolygonRenderer::startRender( QgsRenderContext& context, const Q

bool QgsInvertedPolygonRenderer::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
{
Q_UNUSED( context );
if ( !context.painter() )
{
return false;
}

// store this feature as a feature to render with decoration if needed
if ( selected || drawVertexMarker )
Expand Down Expand Up @@ -223,6 +231,10 @@ void QgsInvertedPolygonRenderer::stopRender( QgsRenderContext& context )
if ( !mSubRenderer ) {
return;
}
if ( !context.painter() )
{
return;
}

for ( FeatureCategoryMap::iterator cit = mFeaturesCategoryMap.begin(); cit != mFeaturesCategoryMap.end(); ++cit)
{
Expand Down

0 comments on commit 19041a8

Please sign in to comment.