Skip to content
Permalink
Browse files

Optimize simple marker: do not construct/destruct "size" all the time

13% speedup when rendering 1m points from memory provider
  • Loading branch information
wonder-sk committed Oct 3, 2014
1 parent 86015ea commit fbbea90da5a7f1e34e2318bd1d44b1e7e1c6be31
@@ -45,6 +45,8 @@ static void _fixQPictureDPI( QPainter* p )
( double )qt_defaultDpiY() / p->device()->logicalDpiY() );
}

const QString QgsSimpleMarkerSymbolLayerV2::EXPR_SIZE( "size" );

//////

QgsSimpleMarkerSymbolLayerV2::QgsSimpleMarkerSymbolLayerV2( QString name, QColor color, QColor borderColor, double size, double angle, QgsSymbolV2::ScaleMethod scaleMethod )
@@ -504,7 +506,7 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
return;
}

QgsExpression *sizeExpression = expression( "size" );
QgsExpression *sizeExpression = expression( EXPR_SIZE );
bool hasDataDefinedSize = context.renderHints() & QgsSymbolV2::DataDefinedSizeScale || sizeExpression;

double scaledSize = mSize;
@@ -133,6 +133,8 @@ class CORE_EXPORT QgsSimpleMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
//Maximum width/height of cache image
static const int mMaximumCacheWidth = 3000;

static const QString EXPR_SIZE;

private:
QgsExpression *mAngleExpression;
QgsExpression *mNameExpression;

0 comments on commit fbbea90

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