Skip to content
Permalink
Browse files

Fill symbol layer: consider already existing transformations on brush…

…es and restore transformation after rendering
  • Loading branch information
mhugent committed Jan 14, 2016
1 parent 886fd72 commit e5bb0b97428d8cdab06cd1e3e02fbca42afd38f4
Showing with 9 additions and 11 deletions.
  1. +9 −11 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
@@ -1572,15 +1572,16 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol

p->setPen( QPen( Qt::NoPen ) );

QTransform bkTransform = mBrush.transform();
if ( context.renderContext().testFlag( QgsRenderContext::RenderMapTile ) )
{
//transform brush to upper left corner of geometry bbox
QPointF leftCorner = points.boundingRect().topLeft();
QTransform leftCornerTransform = QTransform::fromTranslate( leftCorner.x(), leftCorner.y() );
mBrush.setTransform( leftCornerTransform );
QTransform t = mBrush.transform();
t.translate( leftCorner.x(), leftCorner.y() );
mBrush.setTransform( t );
}


if ( context.selected() )
{
QColor selColor = context.renderContext().selectionColor();
@@ -1591,18 +1592,13 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
_renderPolygon( p, points, rings, context );
}

if ( qgsDoubleNear( mNextAngle, 0.0 ) )
{
p->setBrush( mBrush );
}
else
if ( !qgsDoubleNear( mNextAngle, 0.0 ) )
{
QTransform t = mBrush.transform();
t.rotate( mNextAngle );
QBrush rotatedBrush = mBrush;
rotatedBrush.setTransform( t );
p->setBrush( rotatedBrush );
mBrush.setTransform( t );
}
p->setBrush( mBrush );
_renderPolygon( p, points, rings, context );
if ( mOutline )
{
@@ -1616,6 +1612,8 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
}
}
}

mBrush.setTransform( bkTransform );
}

bool QgsImageFillSymbolLayer::setSubSymbol( QgsSymbolV2* symbol )

0 comments on commit e5bb0b9

Please sign in to comment.
You can’t perform that action at this time.