mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
[effect] fix issue with svg marker and antialiasing (fixes #14960)
Credit for original patch to @nirvn
This commit is contained in:
parent
a625eeb508
commit
179a92cd65
@ -105,10 +105,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;
|
||||
|
||||
|
@ -153,10 +153,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
|
||||
|
@ -129,6 +129,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() );
|
||||
|
@ -64,6 +64,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 )
|
||||
|
||||
|
@ -2042,6 +2042,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user