Skip to content

Commit

Permalink
Some optimisations to gradient fill renderer
Browse files Browse the repository at this point in the history
speeds drawing up by ~20% in some circumstances
  • Loading branch information
nyalldawson committed Jan 8, 2015
1 parent b4ad637 commit 7245bf8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/core/symbology-ng/qgsfillsymbollayerv2.cpp
Expand Up @@ -553,6 +553,15 @@ QString QgsGradientFillSymbolLayerV2::layerType() const

void QgsGradientFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, const QPolygonF& points )
{

if ( mDataDefinedProperties.isEmpty() && !mReferencePoint1IsCentroid && !mReferencePoint2IsCentroid )
{
//shortcut
applyGradient( context, mBrush, mColor, mColor2, mGradientColorType, mGradientRamp, mGradientType, mCoordinateMode,
mGradientSpread, mReferencePoint1, mReferencePoint2, mAngle );
return;
}

//first gradient color
QgsExpression* colorExpression = expression( "color" );
QColor color = mColor;
Expand Down Expand Up @@ -812,11 +821,10 @@ void QgsGradientFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QList
return;
}

QPen mSelPen;
applyDataDefinedSymbology( context, points );

p->setBrush( context.selected() ? mSelBrush : mBrush );
p->setPen( QPen( Qt::NoPen ) );
p->setPen( Qt::NoPen );

QPointF offset;
if ( !mOffset.isNull() )
Expand Down

0 comments on commit 7245bf8

Please sign in to comment.