diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-08-20 08:07:00 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-08-20 09:53:38 (GMT) |
commit | 909cdf082fd99ce8bdcb99a9db38d09f52d869aa (patch) | |
tree | d9908456af5eb6f6e5ae374de8d93f6bcfc819e2 /src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | |
parent | 264eb347595cc92a444e3908831d89acef1f05b3 (diff) | |
download | Qt-909cdf082fd99ce8bdcb99a9db38d09f52d869aa.zip Qt-909cdf082fd99ce8bdcb99a9db38d09f52d869aa.tar.gz Qt-909cdf082fd99ce8bdcb99a9db38d09f52d869aa.tar.bz2 |
Performance issue in QGraphicsItem::addParentItem while building the
scene bottom-up.
When adding n items, the depth was computed n² times. Adding lazy computation
fixes this performance issue.
Reviewed-by: Andreas
Diffstat (limited to 'src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index d68183c..a80cdca 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -419,8 +419,8 @@ bool QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withoutCache(const QGra // Find common ancestor, and each item's ancestor closest to the common // ancestor. - int item1Depth = d1->depth; - int item2Depth = d2->depth; + int item1Depth = d1->depth(); + int item2Depth = d2->depth(); const QGraphicsItem *p = item1; const QGraphicsItem *t1 = item1; while (item1Depth > item2Depth && (p = p->d_ptr->parent)) { |