Skip to content

Commit 7245bf8

Browse files
committed
Some optimisations to gradient fill renderer
speeds drawing up by ~20% in some circumstances
1 parent b4ad637 commit 7245bf8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/core/symbology-ng/qgsfillsymbollayerv2.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,15 @@ QString QgsGradientFillSymbolLayerV2::layerType() const
553553

554554
void QgsGradientFillSymbolLayerV2::applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, const QPolygonF& points )
555555
{
556+
557+
if ( mDataDefinedProperties.isEmpty() && !mReferencePoint1IsCentroid && !mReferencePoint2IsCentroid )
558+
{
559+
//shortcut
560+
applyGradient( context, mBrush, mColor, mColor2, mGradientColorType, mGradientRamp, mGradientType, mCoordinateMode,
561+
mGradientSpread, mReferencePoint1, mReferencePoint2, mAngle );
562+
return;
563+
}
564+
556565
//first gradient color
557566
QgsExpression* colorExpression = expression( "color" );
558567
QColor color = mColor;
@@ -812,11 +821,10 @@ void QgsGradientFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QList
812821
return;
813822
}
814823

815-
QPen mSelPen;
816824
applyDataDefinedSymbology( context, points );
817825

818826
p->setBrush( context.selected() ? mSelBrush : mBrush );
819-
p->setPen( QPen( Qt::NoPen ) );
827+
p->setPen( Qt::NoPen );
820828

821829
QPointF offset;
822830
if ( !mOffset.isNull() )

0 commit comments

Comments
 (0)