diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-31 05:11:49 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-31 05:11:49 (GMT) |
commit | e241d607aba775d1ed0c8ff537ac69b9bacb18ed (patch) | |
tree | 7a4236945952938df052ca5842819877f435195c /src | |
parent | 72a6ac6e9a2f6f028994548670cb2c6524864186 (diff) | |
download | Qt-e241d607aba775d1ed0c8ff537ac69b9bacb18ed.zip Qt-e241d607aba775d1ed0c8ff537ac69b9bacb18ed.tar.gz Qt-e241d607aba775d1ed0c8ff537ac69b9bacb18ed.tar.bz2 |
Fixes QGraphicsEffect offset bugs.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicseffect.cpp | 5 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpixmapfilter.cpp | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicseffect.cpp b/src/gui/graphicsview/qgraphicseffect.cpp index 9196ee0..37e3d8c 100644 --- a/src/gui/graphicsview/qgraphicseffect.cpp +++ b/src/gui/graphicsview/qgraphicseffect.cpp @@ -543,7 +543,6 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source QPoint offset; const int radius = d->blurRadius; - const int delta = radius * 3; if (source->isPixmap()) { // No point in drawing in device coordinates (pixmap will be scaled anyways). @@ -555,7 +554,7 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source overlay = brightened(overlay, 70); img = composited(img, overlay, d->opacity, QPainter::CompositionMode_Overlay); - painter->drawImage(offset - QPoint(delta, delta), img); + painter->drawImage(offset, img); return; } @@ -571,7 +570,7 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source // Draw using an untransformed painter. QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); - painter->drawImage(offset - QPoint(radius * 3, radius * 3), img); + painter->drawImage(offset, img); painter->setWorldTransform(restoreTransform); } diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 9700965..991f2b2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -10054,7 +10054,7 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP const QRectF sourceRect = boundingRect(system); QRect effectRect = item->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect(); if (offset) - *offset = sourceRect.toAlignedRect().topLeft(); + *offset = effectRect.topLeft(); if (deviceCoordinates) { // Clip to viewport rect. diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index b7b3733..579d057 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -586,7 +586,9 @@ Qt::TransformationMode QPixmapBlurFilter::quality() const */ QRectF QPixmapBlurFilter::boundingRectFor(const QRectF &rect) const { - return rect; + Q_D(const QPixmapBlurFilter); + const qreal delta = d->radius * 2; + return rect.adjusted(-delta, -delta, delta, delta); } // Blur the image according to the blur radius |