diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-16 08:24:47 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-04-16 08:24:47 (GMT) |
commit | ee1e6222114028c2ff181f972e32f15011723b5f (patch) | |
tree | cac3620d648f1a7c6668c7bb3795cb0f4295baf9 /src/gui/graphicsview/qgraphicsitem_p.h | |
parent | cbec6d9481bf8f55834eafac4eca53f85206b240 (diff) | |
parent | d43d33eb3121519d0025ad433d5c186365c47ef6 (diff) | |
download | Qt-ee1e6222114028c2ff181f972e32f15011723b5f.zip Qt-ee1e6222114028c2ff181f972e32f15011723b5f.tar.gz Qt-ee1e6222114028c2ff181f972e32f15011723b5f.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into windows-7-multitouch
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem_p.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 228368c..b1184fb 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -134,10 +134,15 @@ public: hasBoundingRegionGranularity(0), flags(0), hasOpacity(0), + hasEffectiveOpacity(0), isWidget(0), dirty(0), dirtyChildren(0), localCollisionHack(0), + dirtyClipPath(1), + emptyClipPath(0), + inSetPosHelper(0), + allChildrenCombineOpacity(1), acceptTouchEvents(0), globalStackingOrder(-1), sceneTransformIndex(-1), @@ -159,11 +164,15 @@ public: virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const; static bool movableAncestorIsSelected(const QGraphicsItem *item); - void setPosHelper(const QPointF &pos, bool update); + void setPosHelper(const QPointF &pos); void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true); - void updateHelper(const QRectF &rect = QRectF(), bool force = false, bool updateCache = false); - void fullUpdateHelper(bool childrenOnly = false); + bool discardUpdateRequest(bool ignoreClipping = false, + bool ignoreVisibleBit = false, + bool ignoreDirtyBit = false) const; + void updateHelper(const QRectF &rect = QRectF(), bool force = false, bool maybeDirtyClipPath = false); + void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false); + void updateEffectiveOpacity(); void resolveEffectiveOpacity(qreal effectiveParentOpacity); void resolveDepth(int parentDepth); void invalidateSceneTransformCache(); @@ -239,6 +248,47 @@ public: QGraphicsItemCache *extraItemCache() const; void removeExtraItemCache(); + inline void setCachedClipPath(const QPainterPath &path) + { + cachedClipPath = path; + dirtyClipPath = 0; + emptyClipPath = 0; + } + + inline void setEmptyCachedClipPath() + { + emptyClipPath = 1; + dirtyClipPath = 0; + } + + void setEmptyCachedClipPathRecursively(const QRectF &emptyIfOutsideThisRect = QRectF()); + + inline void invalidateCachedClipPath() + { /*static int count = 0 ;qWarning("%i", ++count);*/ dirtyClipPath = 1; emptyClipPath = 0; } + + void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF()); + void updateCachedClipPathFromSetPosHelper(const QPointF &newPos); + + inline bool isFullyTransparent() const + { return hasEffectiveOpacity && qFuzzyIsNull(q_func()->effectiveOpacity()); } + + inline bool childrenCombineOpacity() const + { return allChildrenCombineOpacity || children.isEmpty(); } + + inline bool isClippedAway() const + { return !dirtyClipPath && q_func()->isClipped() && (emptyClipPath || cachedClipPath.isEmpty()); } + + inline bool childrenClippedToShape() const + { return (flags & QGraphicsItem::ItemClipsChildrenToShape) || children.isEmpty(); } + + inline bool isInvisible() const + { + return !visible + || (childrenClippedToShape() && isClippedAway()) + || (childrenCombineOpacity() && isFullyTransparent()); + } + + QPainterPath cachedClipPath; QPointF pos; qreal z; QGraphicsScene *scene; @@ -269,10 +319,15 @@ public: // New 32 bytes quint32 hasOpacity : 1; + quint32 hasEffectiveOpacity : 1; quint32 isWidget : 1; quint32 dirty : 1; quint32 dirtyChildren : 1; quint32 localCollisionHack : 1; + quint32 dirtyClipPath : 1; + quint32 emptyClipPath : 1; + quint32 inSetPosHelper : 1; + quint32 allChildrenCombineOpacity : 1; quint32 acceptTouchEvents : 1; // Optional stacking order |