diff options
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 9 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsscene.cpp | 24 |
2 files changed, 20 insertions, 13 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index ce74b4f..b7fb122 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -55,6 +55,7 @@ #include "qgraphicsitem.h" #include "qpixmapcache.h" +#include "qgraphicsview_p.h" #include <QtCore/qpoint.h> @@ -365,6 +366,14 @@ public: || (childrenCombineOpacity() && isFullyTransparent()); } + inline bool updateHelper(QGraphicsViewPrivate *view, const QRectF &rect, const QTransform &xform) const + { + Q_ASSERT(view); + if (hasBoundingRegionGranularity) + return view->updateRegion(xform.map(QRegion(rect.toRect()))); + return view->updateRect(xform.mapRect(rect).toRect()); + } + inline QTransform transformToParent() const; QPainterPath cachedClipPath; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7dbe6d9..3f4bdde 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5395,21 +5395,19 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool if (dirtyRect.isEmpty()) continue; // Discard updates outside the bounding rect. - QTransform deviceTransform = item->d_ptr->sceneTransform; - if (view->isTransformed()) { - if (!untransformableItem) - deviceTransform *= view->viewportTransform(); - else - deviceTransform = item->deviceTransform(view->viewportTransform()); - } - - if (item->d_ptr->hasBoundingRegionGranularity) { - if (!viewPrivate->updateRegion(deviceTransform.map(QRegion(dirtyRect.toRect())))) - paintedViewBoundingRect = QRect(); + bool valid = false; + if (untransformableItem) { + valid = item->d_ptr->updateHelper(viewPrivate, dirtyRect, + item->deviceTransform(view->viewportTransform())); + } else if (!view->isTransformed()) { + valid = item->d_ptr->updateHelper(viewPrivate, dirtyRect, item->d_ptr->sceneTransform); } else { - if (!viewPrivate->updateRect(deviceTransform.mapRect(dirtyRect).toRect())) - paintedViewBoundingRect = QRect(); + QTransform deviceTransform = item->d_ptr->sceneTransform; + deviceTransform *= view->viewportTransform(); + valid = !item->d_ptr->updateHelper(viewPrivate, dirtyRect, deviceTransform); } + if (!valid) + paintedViewBoundingRect = QRect(); } } } |