Skip to content
Permalink
Browse files
Fix simple marker transparency (#3658)
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 9a1c5a6fb82727677c4945cf56d578ef23195964
Showing with 20 additions and 14 deletions.
  1. +20 −14 src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
@@ -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;
@@ -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
{
@@ -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 )

0 comments on commit 9a1c5a6

Please sign in to comment.