Skip to content
Permalink
Browse files
Don't needlessly try to calculate data defined opacity for symbols (#…
…46003)

Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
  • Loading branch information
qgis-bot and nyalldawson committed Nov 12, 2021
1 parent 11ff1fa commit 8a58398cd489c3bc2d3bdb0cdf0e8fab767d1f81
Showing with 6 additions and 3 deletions.
  1. +2 −1 src/core/symbology/qgsfillsymbol.cpp
  2. +2 −1 src/core/symbology/qgslinesymbol.cpp
  3. +2 −1 src/core/symbology/qgsmarkersymbol.cpp
@@ -38,7 +38,8 @@ QgsFillSymbol::QgsFillSymbol( const QgsSymbolLayerList &layers )

void QgsFillSymbol::renderPolygon( const QPolygonF &points, const QVector<QPolygonF> *rings, const QgsFeature *f, QgsRenderContext &context, int layerIdx, bool selected )
{
const double opacity = dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, context.expressionContext(), mOpacity * 100 ) * 0.01;
const double opacity = dataDefinedProperties().hasActiveProperties() ? dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, context.expressionContext(), mOpacity * 100 ) * 0.01
: mOpacity;

QgsSymbolRenderContext symbolContext( context, QgsUnitTypes::RenderUnknownUnit, opacity, selected, mRenderHints, f );
symbolContext.setOriginalGeometryType( QgsWkbTypes::PolygonGeometry );
@@ -203,7 +203,8 @@ QgsProperty QgsLineSymbol::dataDefinedWidth() const

void QgsLineSymbol::renderPolyline( const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layerIdx, bool selected )
{
const double opacity = dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, context.expressionContext(), mOpacity * 100 ) * 0.01;
const double opacity = dataDefinedProperties().hasActiveProperties() ? dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, context.expressionContext(), mOpacity * 100 ) * 0.01
: mOpacity;

//save old painter
QPainter *renderPainter = context.painter();
@@ -413,7 +413,8 @@ void QgsMarkerSymbol::renderPointUsingLayer( QgsMarkerSymbolLayer *layer, QPoint

void QgsMarkerSymbol::renderPoint( QPointF point, const QgsFeature *f, QgsRenderContext &context, int layerIdx, bool selected )
{
const double opacity = dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, context.expressionContext(), mOpacity * 100 ) * 0.01;
const double opacity = dataDefinedProperties().hasActiveProperties() ? dataDefinedProperties().valueAsDouble( QgsSymbol::PropertyOpacity, context.expressionContext(), mOpacity * 100 ) * 0.01
: mOpacity;

QgsSymbolRenderContext symbolContext( context, QgsUnitTypes::RenderUnknownUnit, opacity, selected, mRenderHints, f );
symbolContext.setGeometryPartCount( symbolRenderContext()->geometryPartCount() );

0 comments on commit 8a58398

Please sign in to comment.