From 6b779a021a9c3d334127a4c460ad7f780a97ddb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 1 Sep 2009 15:52:27 +0200 Subject: Fix rounding bug in QGraphicsOpacityEffect. The pixmap was painted at wrong offset. --- src/gui/effects/qgraphicseffect.cpp | 9 +++++---- 1 file 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; -- cgit v0.12