summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-12-11 10:06:03 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-12-11 10:43:01 (GMT)
commit343de9228ae65c36c4a9a45297d45cdeb04a8e44 (patch)
treedadebf5d01e931eeb053c70e4ef92e12deb996bb /src/gui/graphicsview/qgraphicsitem.cpp
parent3a8a1f83d60ec16e4c61e2b0a327a5af02917a5a (diff)
downloadQt-343de9228ae65c36c4a9a45297d45cdeb04a8e44.zip
Qt-343de9228ae65c36c4a9a45297d45cdeb04a8e44.tar.gz
Qt-343de9228ae65c36c4a9a45297d45cdeb04a8e44.tar.bz2
Fixed qgraphicseffectsource autotest.
Prevent crashing when asking for a source pixmap in logical coordinates and PadToEffectiveBoundingRect mode. Also, change the expected values for the test that uses LogicalCoordinates and PadToEffectiveBoundingRect mode to reflect that the boundingRectFor() function applies padding in device coordinates (and in this case there is a scale by 2 when drawing the effect). Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 8bbe929..c879c5c 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -10684,9 +10684,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
QRectF effectRectF;
if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
- effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
- if (system == Qt::LogicalCoordinates)
- effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ if (info) {
+ effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
+ if (info && system == Qt::LogicalCoordinates)
+ effectRectF = info->painter->worldTransform().inverted().mapRect(effectRectF);
+ } else {
+ // no choice but to send a logical coordinate bounding rect to boundingRectFor
+ effectRectF = item->graphicsEffect()->boundingRectFor(sourceRect);
+ }
} else if (mode == QGraphicsEffect::PadToTransparentBorder) {
// adjust by 1.5 to account for cosmetic pens
effectRectF = sourceRect.adjusted(-1.5, -1.5, 1.5, 1.5);