From e9a21246698b7106b98be2d3dbf9c481f80fb81a Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sat, 2 Dec 2017 10:05:04 +0100 Subject: [PATCH] [SceneOpenGL] Port from QRegion::rects() to QRegion iterators This code path is executed a lot. Saves creating a temporary QVector. Differential Revision: https://phabricator.kde.org/D9081 --- plugins/scenes/opengl/scene_opengl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index ff865c8281..9a02c26ee0 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -798,7 +798,7 @@ void SceneOpenGL::extendPaintRegion(QRegion ®ion, bool opaqueFullscreen) // movie aspect - two times ;-) It's a Fox format, though, so maybe we want to restrict // to 2.20:1 - Panavision - which has actually been used for interesting movies ...) // would be 57% of 5/4 - foreach (const QRect &r, region.rects()) { + for (const QRect &r : region) { // damagedPixels += r.width() * r.height(); // combined window damage test damagedPixels = r.width() * r.height(); // experimental single window damage testing if (damagedPixels > fullRepaintLimit) { @@ -1178,7 +1178,7 @@ bool SceneOpenGL::Window::beginRenderWindow(int mask, const QRegion ®ion, Win const QRegion filterRegion = region.translated(-x(), -y()); // split all quads in bounding rect with the actual rects in the region foreach (const WindowQuad &quad, data.quads) { - foreach (const QRect &r, filterRegion.rects()) { + for (const QRect &r : filterRegion) { const QRectF rf(r); const QRectF quadRect(QPointF(quad.left(), quad.top()), QPointF(quad.right(), quad.bottom())); const QRectF &intersected = rf.intersected(quadRect);