Skip to content

Commit

Permalink
Fill symbol layer: consider already existing transformations on brush…
Browse files Browse the repository at this point in the history
…es and restore transformation after rendering
  • Loading branch information
mhugent committed Jan 14, 2016
1 parent 886fd72 commit e5bb0b9
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -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();
Expand All @@ -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 )
{
Expand All @@ -1616,6 +1612,8 @@ void QgsImageFillSymbolLayer::renderPolygon( const QPolygonF& points, QList<QPol
}
}
}

mBrush.setTransform( bkTransform );
}

bool QgsImageFillSymbolLayer::setSubSymbol( QgsSymbolV2* symbol )
Expand Down

0 comments on commit e5bb0b9

Please sign in to comment.