Skip to content
Permalink
Browse files

[effect] fix issue with svg marker and antialiasing (fixes #14960)

Credit for original patch to @nirvn

(cherry-picked from 179a92c)
  • Loading branch information
nyalldawson committed Jun 30, 2016
1 parent 5aa69ce commit 0a93bdd3449fcc6bc54fc24ad5f8e928a492f722
@@ -78,10 +78,10 @@ class QgsMapSettings
//! Get color that is used for drawing of selected vector features
QColor selectionColor() const;

//! Enumeration of flags that adjust the way how map is rendered
//! Enumeration of flags that adjust the way the map is rendered
enum Flag
{
Antialiasing, //!< Enable anti-aliasin for map rendering
Antialiasing, //!< Enable anti-aliasing for map rendering
DrawEditingInfo, //!< Enable drawing of vertex markers for layers in editing mode
ForceVectorOutput, //!< Vector graphics should not be cached and drawn as raster images
UseAdvancedEffects, //!< Enable layer transparency and blending effects
@@ -21,7 +21,8 @@ class QgsRenderContext
UseRenderingOptimization, //!< Enable vector simplification and other rendering optimizations
DrawSelection, //!< Whether vector selections should be shown in the rendered map
DrawSymbolBounds, //!< Draw bounds of symbols (for debugging/testing)
RenderMapTile
RenderMapTile, //!< Draw map such that there are no problems between adjacent tiles
Antialiasing, //!< Use antialiasing while drawing
};
typedef QFlags<QgsRenderContext::Flag> Flags;

@@ -125,10 +125,10 @@ class CORE_EXPORT QgsMapSettings
//! Get color that is used for drawing of selected vector features
QColor selectionColor() const { return mSelectionColor; }

//! Enumeration of flags that adjust the way how map is rendered
//! Enumeration of flags that adjust the way the map is rendered
enum Flag
{
Antialiasing = 0x01, //!< Enable anti-aliasin for map rendering
Antialiasing = 0x01, //!< Enable anti-aliasing for map rendering
DrawEditingInfo = 0x02, //!< Enable drawing of vertex markers for layers in editing mode
ForceVectorOutput = 0x04, //!< Vector graphics should not be cached and drawn as raster images
UseAdvancedEffects = 0x08, //!< Enable layer transparency and blending effects
@@ -123,6 +123,7 @@ QgsRenderContext QgsRenderContext::fromMapSettings( const QgsMapSettings& mapSet
ctx.setFlag( DrawSelection, mapSettings.testFlag( QgsMapSettings::DrawSelection ) );
ctx.setFlag( DrawSymbolBounds, mapSettings.testFlag( QgsMapSettings::DrawSymbolBounds ) );
ctx.setFlag( RenderMapTile, mapSettings.testFlag( QgsMapSettings::RenderMapTile ) );
ctx.setFlag( Antialiasing, mapSettings.testFlag( QgsMapSettings::Antialiasing ) );
ctx.setRasterScaleFactor( 1.0 );
ctx.setScaleFactor( mapSettings.outputDpi() / 25.4 ); // = pixels per mm
ctx.setRendererScale( mapSettings.scale() );
@@ -63,6 +63,7 @@ class CORE_EXPORT QgsRenderContext
DrawSelection = 0x10, //!< Whether vector selections should be shown in the rendered map
DrawSymbolBounds = 0x20, //!< Draw bounds of symbols (for debugging/testing)
RenderMapTile = 0x40, //!< Draw map such that there are no problems between adjacent tiles
Antialiasing = 0x80, //!< Use antialiasing while drawing
};
Q_DECLARE_FLAGS( Flags, Flag )

@@ -1437,6 +1437,13 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( QPointF point, QgsSymbolV2RenderCon
}

p->restore();

if ( context.renderContext().flags() & QgsRenderContext::Antialiasing )
{
// workaround issue with nested QPictures forgetting antialiasing flag - see http://hub.qgis.org/issues/14960
p->setRenderHint( QPainter::Antialiasing );
}

}

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

0 comments on commit 0a93bdd

Please sign in to comment.
You can’t perform that action at this time.