From 873d38225e183fba83b089f3d7672d30f61276f7 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sat, 2 Dec 2017 10:04:22 +0100 Subject: [PATCH] [GLVertexBuffer] Port from QRegion::rects() to QRegion iterators This code path is executed a lot during animations (e.g. maximize, minimize). Saves creating a temporary QVector. Differential Revision: https://phabricator.kde.org/D9082 --- libkwineffects/kwinglutils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 8d1d0eb65d..d1def249a0 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -2123,7 +2123,7 @@ void GLVertexBuffer::draw(const QRegion ®ion, GLenum primitiveMode, int first glDrawElementsBaseVertex(GL_TRIANGLES, count, GL_UNSIGNED_SHORT, nullptr, first); } else { // Clip using scissoring - foreach (const QRect &r, region.rects()) { + for (const QRect &r : region) { glScissor((r.x() - s_virtualScreenGeometry.x()) * s_virtualScreenScale, (s_virtualScreenGeometry.height() + s_virtualScreenGeometry.y() - r.y() - r.height()) * s_virtualScreenScale, r.width() * s_virtualScreenScale, @@ -2138,7 +2138,7 @@ void GLVertexBuffer::draw(const QRegion ®ion, GLenum primitiveMode, int first glDrawArrays(primitiveMode, first, count); } else { // Clip using scissoring - foreach (const QRect &r, region.rects()) { + for (const QRect &r : region) { glScissor((r.x() - s_virtualScreenGeometry.x()) * s_virtualScreenScale, (s_virtualScreenGeometry.height() + s_virtualScreenGeometry.y() - r.y() - r.height()) * s_virtualScreenScale, r.width() * s_virtualScreenScale,