diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-07 08:31:52 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-08 15:28:39 (GMT) |
commit | 1336f8268512a4ad29732acf75f2e6c4d41683ce (patch) | |
tree | f20c5e7f6c632adc1d0e5184a5bcabc0d8c68932 /src/gui/graphicsview/qgraphicsview.cpp | |
parent | d228015c67614051df8ae0b2f0483572fd667b83 (diff) | |
download | Qt-1336f8268512a4ad29732acf75f2e6c4d41683ce.zip Qt-1336f8268512a4ad29732acf75f2e6c4d41683ce.tar.gz Qt-1336f8268512a4ad29732acf75f2e6c4d41683ce.tar.bz2 |
Reduce QTransform operations in Graphics View.
Use the item's cached scene transform directly instead of always making a copy
of it. Moreover, we don't have to use the transform at all if the scene
transform is a "translate only" transform :-). QTransform already use
the same cut-offs, but it must update the type() before it can find out.
We don't have to check the type() because that is already stored (and we
usually don't call type() when we store the value either).
All auto-tests pass.
Diffstat (limited to 'src/gui/graphicsview/qgraphicsview.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsview.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 995f3f3..1e34320 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1864,7 +1864,12 @@ void QGraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRati void QGraphicsView::fitInView(const QGraphicsItem *item, Qt::AspectRatioMode aspectRatioMode) { QPainterPath path = item->isClipped() ? item->clipPath() : item->shape(); - fitInView(item->sceneTransform().map(path).boundingRect(), aspectRatioMode); + if (item->d_ptr->hasTranslateOnlySceneTransform()) { + path.translate(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy()); + fitInView(path.boundingRect(), aspectRatioMode); + } else { + fitInView(item->d_ptr->sceneTransform.map(path).boundingRect(), aspectRatioMode); + } } /*! |