Skip to content

Commit

Permalink
Fix unbalanced painter save/restore for map items
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 19, 2017
1 parent 7c8f4c3 commit cbc8570
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/layout/qgslayoutitemmap.cpp
Expand Up @@ -886,6 +886,7 @@ void QgsLayoutItemMap::paint( QPainter *painter, const QStyleOptionGraphicsItem
painter->scale( 1 / dotsPerMM, 1 / dotsPerMM ); // scale painter from mm to dots
painter->drawImage( std::round( -tl.x()* dotsPerMM ), std::round( -tl.y() * dotsPerMM ), image );
painter->scale( dotsPerMM, dotsPerMM );
painter->restore();
}
else
{
Expand All @@ -895,6 +896,7 @@ void QgsLayoutItemMap::paint( QPainter *painter, const QStyleOptionGraphicsItem
drawMapBackground( painter );
}

painter->save();
painter->setClipRect( thisPaintRect );
painter->save();
painter->translate( mXOffset, mYOffset );
Expand All @@ -917,14 +919,13 @@ void QgsLayoutItemMap::paint( QPainter *painter, const QStyleOptionGraphicsItem
mGridStack->drawItems( painter );
}
drawAnnotations( painter );

painter->restore();
}

if ( shouldDrawPart( Frame ) )
{
drawMapFrame( painter );
}
painter->restore();
mDrawing = false;
}
}
Expand Down

0 comments on commit cbc8570

Please sign in to comment.