summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
authorBjoern Erik Nilsen <bjorn.nilsen@nokia.com>2009-03-23 14:54:30 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-04-06 11:49:45 (GMT)
commit95fa7a93bc840e0f49ee30e76abb2b4f8579c997 (patch)
treef1617e82037e61c978f993c9e5d7de86819588c0 /src/gui/graphicsview/qgraphicsitem.cpp
parentc1909321a486621ef196dd4bb3cf354406d86d46 (diff)
downloadQt-95fa7a93bc840e0f49ee30e76abb2b4f8579c997.zip
Qt-95fa7a93bc840e0f49ee30e76abb2b4f8579c997.tar.gz
Qt-95fa7a93bc840e0f49ee30e76abb2b4f8579c997.tar.bz2
Fixes: Optimization: Clip path is empty if the bounding rect is empty.
RevBy: TrustMe
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index badc41e..75b6cf1 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3151,9 +3151,18 @@ QPainterPath QGraphicsItem::clipPath() const
return d->cachedClipPath;
}
+ const QRectF thisBoundingRect(boundingRect());
+ if (thisBoundingRect.isEmpty()) {
+ if (d_ptr->flags & ItemClipsChildrenToShape)
+ d_ptr->setEmptyCachedClipPathRecursively();
+ else
+ d_ptr->setEmptyCachedClipPath();
+ return QPainterPath();
+ }
+
QPainterPath clip;
// Start with the item's bounding rect.
- clip.addRect(boundingRect());
+ clip.addRect(thisBoundingRect);
if (d->ancestorFlags & QGraphicsItemPrivate::AncestorClipsChildren) {
const QGraphicsItem *parent = this;