Skip to content

Commit

Permalink
Fix printing with composition effects
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 1, 2013
1 parent b7064db commit 32ec65c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/core/composer/qgscomposereffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

}

Expand Down
1 change: 1 addition & 0 deletions src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void QgsComposerItem::init( bool manageZValue )
// Setup composer effect
mEffect = new QgsComposerEffect();
setGraphicsEffect( mEffect );

}

QgsComposerItem::~QgsComposerItem()
Expand Down

0 comments on commit 32ec65c

Please sign in to comment.