diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-10-13 12:44:54 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-10-14 11:45:59 (GMT) |
commit | 997dbe14d8bd4f370a7c972b594b5bc12e80f027 (patch) | |
tree | 9fd09072daf22bfd1fba2b5e66775fef04772b94 /src/gui/effects | |
parent | b0557f0d11b247284e2b5e879b34f9d28a99e3e4 (diff) | |
download | Qt-997dbe14d8bd4f370a7c972b594b5bc12e80f027.zip Qt-997dbe14d8bd4f370a7c972b594b5bc12e80f027.tar.gz Qt-997dbe14d8bd4f370a7c972b594b5bc12e80f027.tar.bz2 |
Fixed wrong use of graphics effects for pixmap graphics items.
The blur, drop shadow, and bloom graphics effects are scale dependent,
since they have radius and offset (in the case of drop shadow)
parameters that are specified in device coordinates. Thus, we can't
apply the effect in logical coordinates and scale up, and need to always
use the device coordinate path for these effects. The opacity and
grayscale effects still use the logical coordinate optimization.
Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src/gui/effects')
-rw-r--r-- | src/gui/effects/qgraphicseffect.cpp | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index ee01fdc..01df46d 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -893,15 +893,8 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) return; } - QPoint offset; - if (source->isPixmap()) { - // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); - d->filter->draw(painter, offset, pixmap); - return; - } - // Draw pixmap in device coordinates to avoid pixmap scaling. + QPoint offset; const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); @@ -1084,15 +1077,8 @@ void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *s return; } - QPoint offset; - if (source->isPixmap()) { - // No point in drawing in device coordinates (pixmap will be scaled anyways). - const QPixmap pixmap = source->pixmap(Qt::LogicalCoordinates, &offset); - d->filter->draw(painter, offset, pixmap); - return; - } - // Draw pixmap in device coordinates to avoid pixmap scaling. + QPoint offset; const QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); QTransform restoreTransform = painter->worldTransform(); painter->setWorldTransform(QTransform()); @@ -1486,10 +1472,8 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source return; } - const Qt::CoordinateSystem system = source->isPixmap() - ? Qt::LogicalCoordinates : Qt::DeviceCoordinates; QPoint offset; - QPixmap pixmap = source->pixmap(system, &offset); + QPixmap pixmap = source->pixmap(Qt::DeviceCoordinates, &offset); QImage result = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); // Blur. @@ -1514,14 +1498,10 @@ void QGraphicsBloomEffect::draw(QPainter *painter, QGraphicsEffectSource *source compPainter.drawImage(0, 0, overlay); compPainter.end(); - if (system == Qt::DeviceCoordinates) { - QTransform restoreTransform = painter->worldTransform(); - painter->setWorldTransform(QTransform()); - painter->drawImage(offset, result); - painter->setWorldTransform(restoreTransform); - } else { - painter->drawImage(offset, result); - } + QTransform restoreTransform = painter->worldTransform(); + painter->setWorldTransform(QTransform()); + painter->drawImage(offset, result); + painter->setWorldTransform(restoreTransform); } QT_END_NAMESPACE |