From 5aeb772eae5cadae58e73298e7a4b8787d706c0b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 3 Sep 2009 14:33:36 +0200 Subject: Fix crash bug when rendering a graphicsview offscreen with effects Reviewed-by: Bjoern Erik Nilsen --- src/gui/graphicsview/qgraphicsitem.cpp | 12 ++++++++---- 1 file 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()) -- cgit v0.12