diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-06-02 20:05:01 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-09 07:31:54 (GMT) |
commit | e5b83ec3dc4e2f4c18b67d45a5699da5a3f05f10 (patch) | |
tree | c2dbdc83885b65392c346c31fec1f410b3501ec5 /src/gui/graphicsview | |
parent | 07dca7a30d4bd1efd8032915700420cca3fd60fa (diff) | |
download | Qt-e5b83ec3dc4e2f4c18b67d45a5699da5a3f05f10.zip Qt-e5b83ec3dc4e2f4c18b67d45a5699da5a3f05f10.tar.gz Qt-e5b83ec3dc4e2f4c18b67d45a5699da5a3f05f10.tar.bz2 |
optimise isFullyTransparent()
This cuts down quite some intructions in some use cases,
making esp. discardUpdateRequest() a bit cheaper.
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index d92d76e..d007f03 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -276,13 +276,8 @@ public: void invalidateCachedClipPathRecursively(bool childrenOnly = false, const QRectF &emptyIfOutsideThisRect = QRectF()); void updateCachedClipPathFromSetPosHelper(const QPointF &newPos); - inline bool isFullyTransparent() const - { return effectiveOpacity() < .001; } - - inline qreal effectiveOpacity() const { - if (!parent) - return opacity; - + inline qreal calcEffectiveOpacity() const + { qreal o = opacity; QGraphicsItem *p = parent; int myFlags = flags; @@ -303,6 +298,23 @@ public: return o; } + inline bool isFullyTransparent() const + { + if (opacity < 0.001) + return true; + if (!parent) + return false; + + return calcEffectiveOpacity() < 0.001; + } + + inline qreal effectiveOpacity() const { + if (!parent || !opacity) + return opacity; + + return calcEffectiveOpacity(); + } + inline bool childrenCombineOpacity() const { if (!children.size()) |