Skip to content

Commit 179a92c

Browse files
committedJun 7, 2016
[effect] fix issue with svg marker and antialiasing (fixes #14960)
Credit for original patch to @nirvn
1 parent a625eeb commit 179a92c

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed
 

‎python/core/qgsmapsettings.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ class QgsMapSettings
105105
//! Get color that is used for drawing of selected vector features
106106
QColor selectionColor() const;
107107

108-
//! Enumeration of flags that adjust the way how map is rendered
108+
//! Enumeration of flags that adjust the way the map is rendered
109109
enum Flag
110110
{
111-
Antialiasing, //!< Enable anti-aliasin for map rendering
111+
Antialiasing, //!< Enable anti-aliasing for map rendering
112112
DrawEditingInfo, //!< Enable drawing of vertex markers for layers in editing mode
113113
ForceVectorOutput, //!< Vector graphics should not be cached and drawn as raster images
114114
UseAdvancedEffects, //!< Enable layer transparency and blending effects

‎python/core/qgsrendercontext.sip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ class QgsRenderContext
2121
UseRenderingOptimization, //!< Enable vector simplification and other rendering optimizations
2222
DrawSelection, //!< Whether vector selections should be shown in the rendered map
2323
DrawSymbolBounds, //!< Draw bounds of symbols (for debugging/testing)
24-
RenderMapTile
24+
RenderMapTile, //!< Draw map such that there are no problems between adjacent tiles
25+
Antialiasing, //!< Use antialiasing while drawing
2526
};
2627
typedef QFlags<QgsRenderContext::Flag> Flags;
2728

‎src/core/qgsmapsettings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ class CORE_EXPORT QgsMapSettings
153153
//! Get color that is used for drawing of selected vector features
154154
QColor selectionColor() const { return mSelectionColor; }
155155

156-
//! Enumeration of flags that adjust the way how map is rendered
156+
//! Enumeration of flags that adjust the way the map is rendered
157157
enum Flag
158158
{
159-
Antialiasing = 0x01, //!< Enable anti-aliasin for map rendering
159+
Antialiasing = 0x01, //!< Enable anti-aliasing for map rendering
160160
DrawEditingInfo = 0x02, //!< Enable drawing of vertex markers for layers in editing mode
161161
ForceVectorOutput = 0x04, //!< Vector graphics should not be cached and drawn as raster images
162162
UseAdvancedEffects = 0x08, //!< Enable layer transparency and blending effects

‎src/core/qgsrendercontext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ QgsRenderContext QgsRenderContext::fromMapSettings( const QgsMapSettings& mapSet
129129
ctx.setFlag( DrawSelection, mapSettings.testFlag( QgsMapSettings::DrawSelection ) );
130130
ctx.setFlag( DrawSymbolBounds, mapSettings.testFlag( QgsMapSettings::DrawSymbolBounds ) );
131131
ctx.setFlag( RenderMapTile, mapSettings.testFlag( QgsMapSettings::RenderMapTile ) );
132+
ctx.setFlag( Antialiasing, mapSettings.testFlag( QgsMapSettings::Antialiasing ) );
132133
ctx.setRasterScaleFactor( 1.0 );
133134
ctx.setScaleFactor( mapSettings.outputDpi() / 25.4 ); // = pixels per mm
134135
ctx.setRendererScale( mapSettings.scale() );

‎src/core/qgsrendercontext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class CORE_EXPORT QgsRenderContext
6464
DrawSelection = 0x10, //!< Whether vector selections should be shown in the rendered map
6565
DrawSymbolBounds = 0x20, //!< Draw bounds of symbols (for debugging/testing)
6666
RenderMapTile = 0x40, //!< Draw map such that there are no problems between adjacent tiles
67+
Antialiasing = 0x80, //!< Use antialiasing while drawing
6768
};
6869
Q_DECLARE_FLAGS( Flags, Flag )
6970

‎src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,13 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( QPointF point, QgsSymbolV2RenderCon
20422042
}
20432043

20442044
p->restore();
2045+
2046+
if ( context.renderContext().flags() & QgsRenderContext::Antialiasing )
2047+
{
2048+
// workaround issue with nested QPictures forgetting antialiasing flag - see http://hub.qgis.org/issues/14960
2049+
p->setRenderHint( QPainter::Antialiasing );
2050+
}
2051+
20452052
}
20462053

20472054
double QgsSvgMarkerSymbolLayerV2::calculateSize( QgsSymbolV2RenderContext& context, bool& hasDataDefinedSize ) const

1 commit comments

Comments
 (1)

nirvn commented on Jun 7, 2016

@nirvn
Contributor

Thanks @nyalldawson .

Please sign in to comment.