summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-02 12:00:03 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-06-09 07:31:00 (GMT)
commit6f218ce216021ff2e8ecf828b2f29b1b9d82b401 (patch)
treec97be6097ccba8f0b3579017c2eacada750de7e2
parentd44332954b2a8e66ba4129c230e8ccc65fd972ea (diff)
downloadQt-6f218ce216021ff2e8ecf828b2f29b1b9d82b401.zip
Qt-6f218ce216021ff2e8ecf828b2f29b1b9d82b401.tar.gz
Qt-6f218ce216021ff2e8ecf828b2f29b1b9d82b401.tar.bz2
Microoptimize: make this function inline.
Also change the order of comparisons, as the transformable flags are most likely to fail first.
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp16
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h6
2 files changed, 7 insertions, 15 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 17cab45..ca39713 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -779,18 +779,6 @@ QPointF QGraphicsItemPrivate::genericMapFromScene(const QPointF &pos,
/*!
\internal
- Returns true if this item or any of its ancestors are untransformable.
-*/
-bool QGraphicsItemPrivate::itemIsUntransformable() const
-{
- return (flags & QGraphicsItem::ItemIgnoresTransformations)
- || (ancestorFlags & AncestorIgnoresTransformations);
-}
-
-
-/*!
- \internal
-
Combines this item's position and transform onto \a transform.
If you need to change this function (e.g., adding more transformation
@@ -799,7 +787,7 @@ bool QGraphicsItemPrivate::itemIsUntransformable() const
void QGraphicsItemPrivate::combineTransformToParent(QTransform *x, const QTransform *viewTransform) const
{
// COMBINE
- if (viewTransform && itemIsUntransformable()) {
+ if (itemIsUntransformable() && viewTransform) {
*x = q_ptr->deviceTransform(*viewTransform);
} else {
if (transform)
@@ -821,7 +809,7 @@ void QGraphicsItemPrivate::combineTransformToParent(QTransform *x, const QTransf
void QGraphicsItemPrivate::combineTransformFromParent(QTransform *x, const QTransform *viewTransform) const
{
// COMBINE
- if (viewTransform && itemIsUntransformable()) {
+ if (itemIsUntransformable() && viewTransform) {
*x = q_ptr->deviceTransform(*viewTransform);
} else {
x->translate(pos.x(), pos.y());
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index d962ad0..61f6496 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -160,7 +160,11 @@ public:
void setIsMemberOfGroup(bool enabled);
void remapItemPos(QEvent *event, QGraphicsItem *item);
QPointF genericMapFromScene(const QPointF &pos, const QWidget *viewport) const;
- bool itemIsUntransformable() const;
+ inline bool itemIsUntransformable() const
+ {
+ return (flags & QGraphicsItem::ItemIgnoresTransformations)
+ || (ancestorFlags & AncestorIgnoresTransformations);
+ }
void combineTransformToParent(QTransform *x, const QTransform *viewTransform = 0) const;
void combineTransformFromParent(QTransform *x, const QTransform *viewTransform = 0) const;