diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-09-01 13:52:27 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-09-01 13:52:27 (GMT) |
commit | 6b779a021a9c3d334127a4c460ad7f780a97ddb9 (patch) | |
tree | 5b3a2b68d3c3cd176f1544a2615da3fe1cbe1859 /src/gui | |
parent | 8abc68d262c40c1f035a2d77779e76f038261a89 (diff) | |
download | Qt-6b779a021a9c3d334127a4c460ad7f780a97ddb9.zip Qt-6b779a021a9c3d334127a4c460ad7f780a97ddb9.tar.gz Qt-6b779a021a9c3d334127a4c460ad7f780a97ddb9.tar.bz2 |
Fix rounding bug in QGraphicsOpacityEffect.
The pixmap was painted at wrong offset.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/effects/qgraphicseffect.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 6624cfb..f60e80e 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -1129,19 +1129,20 @@ void QGraphicsOpacityEffect::draw(QPainter *painter, QGraphicsEffectSource *sour const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); painter->drawPixmap(offset, pixmap); } else { - QRectF srcBrect = source->boundingRect(); - QPixmap pixmap(srcBrect.size().toSize()); + QRect srcBrect = source->boundingRect().toAlignedRect(); + offset = srcBrect.topLeft(); + QPixmap pixmap(srcBrect.size()); pixmap.fill(Qt::transparent); QPainter pixmapPainter(&pixmap); pixmapPainter.setRenderHints(painter->renderHints()); - pixmapPainter.translate(-srcBrect.topLeft()); + pixmapPainter.translate(-offset); source->draw(&pixmapPainter); pixmapPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); pixmapPainter.fillRect(srcBrect, d->opacityMask); pixmapPainter.end(); - painter->drawPixmap(srcBrect.topLeft(), pixmap); + painter->drawPixmap(offset, pixmap); } } else { // Draw pixmap in device coordinates to avoid pixmap scaling; |