Only draw source once if forcing vector and any part of stack requires raster

Avoids multiple stacked sources when forcing vector outputs
This commit is contained in:
Nyall Dawson 2025-06-11 13:37:00 +10:00
parent fa40eedcd3
commit afc2d008fa
2 changed files with 22 additions and 0 deletions

View File

@ -94,6 +94,27 @@ void QgsEffectStack::draw( QgsRenderContext &context )
{
QPainter *destPainter = context.painter();
if ( context.rasterizedRenderingPolicy() == Qgis::RasterizedRenderingPolicy::ForceVector )
{
// can we render this stack if we're forcing vectors?
bool requiresRasterization = false;
for ( const QgsPaintEffect *effect : std::as_const( mEffectList ) )
{
if ( effect->enabled() && effect->flags().testFlag( Qgis::PaintEffectFlag::RequiresRasterization ) )
{
requiresRasterization = true;
break;
}
}
if ( requiresRasterization )
{
//just draw unmodified source, we can't render this effect stack when forcing vectors
drawSource( *context.painter() );
}
return;
}
//first, we build up a list of rendered effects
//we do this moving backwards through the stack, so that each effect's results
//becomes the source of the previous effect

View File

@ -19,6 +19,7 @@
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgis.h"
#include <QPainter>
#include <QDomDocument>
#include <QDomElement>