summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@nokia.com>2009-09-03 12:33:36 (GMT)
committerThomas Hartmann <Thomas.Hartmann@nokia.com>2009-09-03 12:33:36 (GMT)
commit5aeb772eae5cadae58e73298e7a4b8787d706c0b (patch)
tree94768faffb75fead7204afc3e9d06c7f7fd313e5 /src/gui
parente5009f8d6f23e16f6895e6e88dd48dd890243683 (diff)
downloadQt-5aeb772eae5cadae58e73298e7a4b8787d706c0b.zip
Qt-5aeb772eae5cadae58e73298e7a4b8787d706c0b.tar.gz
Qt-5aeb772eae5cadae58e73298e7a4b8787d706c0b.tar.bz2
Fix crash bug when rendering a graphicsview offscreen with effects
Reviewed-by: Bjoern Erik Nilsen
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 4c7765d..b7c2e26 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -10357,10 +10357,14 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
effectRect.setY(0);
}
// NB! We use +-1 for historical reasons (see QRect documentation).
- if (right + 1 > info->widget->width())
- effectRect.setRight(info->widget->width() - 1);
- if (bottom + 1 > info->widget->height())
- effectRect.setBottom(info->widget->height() -1);
+ QPaintDevice *device = info->painter->device();
+ const int deviceWidth = device->width();
+ const int deviceHeight = device->height();
+ if (right + 1 > deviceWidth)
+ effectRect.setRight(deviceWidth - 1);
+ if (bottom + 1 > deviceHeight)
+ effectRect.setBottom(deviceHeight -1);
+
}
if (effectRect.isEmpty())