Skip to content

Commit

Permalink
Fix simple marker transparency (#3658)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15605 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Mar 25, 2011
1 parent 9869edc commit 9a1c5a6
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,27 @@ QString QgsSimpleMarkerSymbolLayerV2::layerType() const

void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
{
mBrush = QBrush( mColor );
mPen = QPen( mBorderColor );
QColor brushColor = mColor;
QColor penColor = mBorderColor;
if ( context.alpha() < 1 )
{
penColor.setAlphaF( context.alpha() );
brushColor.setAlphaF( context.alpha() );
}
mBrush = QBrush( brushColor );
mPen = QPen( penColor );
mPen.setWidthF( context.outputLineWidth( mPen.widthF() ) );

QColor selColor = context.selectionColor();
mSelBrush = QBrush( selColor );
mSelPen = QPen( selColor == mColor ? selColor : mBorderColor );
mSelPen.setWidthF( mPen.widthF() );
QColor selBrushColor = context.selectionColor();
QColor selPenColor = selBrushColor == mColor ? selBrushColor : mBorderColor;
if ( context.alpha() < 1 )
{
selBrushColor.setAlphaF( context.alpha() );
selPenColor.setAlphaF( context.alpha() );
}
mSelBrush = QBrush( selBrushColor );
mSelPen = QPen( selPenColor );
mSelPen.setWidthF( context.outputLineWidth( mPen.widthF() ) );

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

if ( mName != "circle" )
mSelPen.setColor( selColor );
mSelPen.setColor( selBrushColor );
}
else
{
Expand Down Expand Up @@ -197,13 +210,6 @@ void QgsSimpleMarkerSymbolLayerV2::prepareCache( QgsSymbolV2RenderContext& conte
drawMarker( &p, context );
p.end();
}

//opacity
if ( context.alpha() < 1.0 )
{
QgsSymbolLayerV2Utils::multiplyImageOpacity( &mCache, context.alpha() );
if ( ! selectionIsOpaque ) QgsSymbolLayerV2Utils::multiplyImageOpacity( &mSelCache, context.alpha() );
}
}

void QgsSimpleMarkerSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
Expand Down

0 comments on commit 9a1c5a6

Please sign in to comment.