QFlickGestureRecognizer: hoist a constant subexpression out of a for loop

It's a virtual function call, followed by another out-of-line
function, so the compiler cannot hoist the expression out of
the loop itself.

But we can, so do it.

Change-Id: Icffa6fa9a667d566b0829a18fea7128625e85920
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
bb10
Marc Mutz 2015-12-16 01:48:24 +01:00
parent 3fc1002489
commit 8b1eb5f420
1 changed files with 2 additions and 1 deletions

View File

@ -584,8 +584,9 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
#ifndef QT_NO_GRAPHICSVIEW
} else if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(as->target())) {
if (go->scene()) {
const auto goBoundingRectMappedToScene = go->mapToScene(go->boundingRect());
foreach (QGraphicsView *gv, go->scene()->views())
scrollerRegion |= gv->mapFromScene(go->mapToScene(go->boundingRect()))
scrollerRegion |= gv->mapFromScene(goBoundingRectMappedToScene)
.translated(gv->mapToGlobal(QPoint(0, 0)));
}
#endif