summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2010-03-02 12:49:33 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2010-03-02 14:29:46 (GMT)
commitfd30cc9fabe6fc023fbca5b93cfdb116fe194514 (patch)
tree3e38dd89ccd3fcd1cd8087e193388e47b9adbac5 /src/gui/graphicsview/qgraphicsitem.cpp
parentb6e312df6cc087dbf45becb91bd43b35913e3684 (diff)
downloadQt-fd30cc9fabe6fc023fbca5b93cfdb116fe194514.zip
Qt-fd30cc9fabe6fc023fbca5b93cfdb116fe194514.tar.gz
Qt-fd30cc9fabe6fc023fbca5b93cfdb116fe194514.tar.bz2
Fixed rendering bugs when scrolling graphics items with drop shadows.
We can't clip source pixmaps to the device rect, as there's no way of knowing which parts of the source pixmap are needed for the part of the graphics effect that's unclipped. Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index bd214e1..368af58 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -10810,6 +10810,7 @@ void QGraphicsItemEffectSourcePrivate::draw(QPainter *painter)
}
}
+// sourceRect must be in the given coordinate system
QRect QGraphicsItemEffectSourcePrivate::paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded) const
{
QRectF effectRectF;
@@ -10819,7 +10820,8 @@ QRect QGraphicsItemEffectSourcePrivate::paddedEffectRect(Qt::CoordinateSystem sy
if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) {
if (info) {
- effectRectF = item->graphicsEffect()->boundingRectFor(boundingRect(Qt::DeviceCoordinates));
+ QRectF deviceRect = system == Qt::DeviceCoordinates ? sourceRect : info->painter->worldTransform().mapRect(sourceRect);
+ effectRectF = item->graphicsEffect()->boundingRectFor(deviceRect);
if (unpadded)
*unpadded = (effectRectF.size() == sourceRect.size());
if (info && system == Qt::LogicalCoordinates)
@@ -10868,30 +10870,6 @@ QPixmap QGraphicsItemEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QP
return static_cast<QGraphicsPixmapItem *>(item)->pixmap();
}
- if (deviceCoordinates) {
- // Clip to viewport rect.
- int left, top, right, bottom;
- effectRect.getCoords(&left, &top, &right, &bottom);
- if (left < 0) {
- if (offset)
- offset->rx() += -left;
- effectRect.setX(0);
- }
- if (top < 0) {
- if (offset)
- offset->ry() += -top;
- effectRect.setY(0);
- }
- // NB! We use +-1 for historical reasons (see QRect documentation).
- 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())
return QPixmap();