Skip to content
Permalink
Browse files

Fix printing with composition effects

  • Loading branch information
nyalldawson committed Apr 1, 2013
1 parent b7064db commit 32ec65cdd595ebe5838907d703afb569d94f5575
Showing with 23 additions and 1 deletion.
  1. +22 −1 src/core/composer/qgscomposereffect.cpp
  2. +1 −0 src/core/composer/qgscomposeritem.cpp
@@ -35,7 +35,28 @@ void QgsComposerEffect::draw( QPainter *painter )

// Set desired composition mode then draw source
painter->setCompositionMode( mCompositionMode );
drawSource( painter );

if ( mCompositionMode == QPainter::CompositionMode_SourceOver )
{
// Normal (sourceover) blending, do faster drawSource operation
drawSource( painter );
return;
}

// Otherwise, draw using pixmap so QPrinter output works as expected
if ( sourceIsPixmap() )
{
// No point in drawing in device coordinates (pixmap will be scaled anyways).
pixmap = sourcePixmap( Qt::LogicalCoordinates, &offset );
}
else
{
// Draw pixmap in device coordinates to avoid pixmap scaling;
pixmap = sourcePixmap( Qt::DeviceCoordinates, &offset );
painter->setWorldTransform( QTransform() );
}

painter->drawPixmap( offset, pixmap );

}

@@ -103,6 +103,7 @@ void QgsComposerItem::init( bool manageZValue )
// Setup composer effect
mEffect = new QgsComposerEffect();
setGraphicsEffect( mEffect );

}

QgsComposerItem::~QgsComposerItem()

0 comments on commit 32ec65c

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