Skip to content

Commit 9a1c5a6

Browse files
author
wonder
committed
Fix simple marker transparency (#3658)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15605 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 9869edc commit 9a1c5a6

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,27 @@ QString QgsSimpleMarkerSymbolLayerV2::layerType() const
7474

7575
void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
7676
{
77-
mBrush = QBrush( mColor );
78-
mPen = QPen( mBorderColor );
77+
QColor brushColor = mColor;
78+
QColor penColor = mBorderColor;
79+
if ( context.alpha() < 1 )
80+
{
81+
penColor.setAlphaF( context.alpha() );
82+
brushColor.setAlphaF( context.alpha() );
83+
}
84+
mBrush = QBrush( brushColor );
85+
mPen = QPen( penColor );
7986
mPen.setWidthF( context.outputLineWidth( mPen.widthF() ) );
8087

81-
QColor selColor = context.selectionColor();
82-
mSelBrush = QBrush( selColor );
83-
mSelPen = QPen( selColor == mColor ? selColor : mBorderColor );
84-
mSelPen.setWidthF( mPen.widthF() );
88+
QColor selBrushColor = context.selectionColor();
89+
QColor selPenColor = selBrushColor == mColor ? selBrushColor : mBorderColor;
90+
if ( context.alpha() < 1 )
91+
{
92+
selBrushColor.setAlphaF( context.alpha() );
93+
selPenColor.setAlphaF( context.alpha() );
94+
}
95+
mSelBrush = QBrush( selBrushColor );
96+
mSelPen = QPen( selPenColor );
97+
mSelPen.setWidthF( context.outputLineWidth( mPen.widthF() ) );
8598

8699
bool hasDataDefinedRotation = context.renderHints() & QgsSymbolV2::DataDefinedRotation;
87100
bool hasDataDefinedSize = context.renderHints() & QgsSymbolV2::DataDefinedSizeScale;
@@ -101,7 +114,7 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& contex
101114
// For these set the selected border color to the selected color
102115

103116
if ( mName != "circle" )
104-
mSelPen.setColor( selColor );
117+
mSelPen.setColor( selBrushColor );
105118
}
106119
else
107120
{
@@ -197,13 +210,6 @@ void QgsSimpleMarkerSymbolLayerV2::prepareCache( QgsSymbolV2RenderContext& conte
197210
drawMarker( &p, context );
198211
p.end();
199212
}
200-
201-
//opacity
202-
if ( context.alpha() < 1.0 )
203-
{
204-
QgsSymbolLayerV2Utils::multiplyImageOpacity( &mCache, context.alpha() );
205-
if ( ! selectionIsOpaque ) QgsSymbolLayerV2Utils::multiplyImageOpacity( &mSelCache, context.alpha() );
206-
}
207213
}
208214

209215
void QgsSimpleMarkerSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )

0 commit comments

Comments
 (0)