From c8e3d670e7863cb207ef2fbdf9a4040ae35aec73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=B6glund?= Date: Fri, 15 Mar 2013 15:16:12 +0100 Subject: [PATCH] kwin: Optimize decoration quad selection Loop directly over the window quad list and check the type instead of using select(WindowQuadDecoration) when separating the decoration quads. This avoids the step of creating an intermediate list, and then looping over that list to separate out the quads that belong to the four sides. --- scene_opengl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index db9dcc8f99..9971499474 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1162,7 +1162,10 @@ void SceneOpenGL::Window::paintDecorations(const WindowPaintData &data, const QR t->layoutDecorationRects(rect[0], rect[1], rect[2], rect[3], Client::WindowRelative); // Split the quads into four lists - foreach (const WindowQuad &quad, data.quads.select(WindowQuadDecoration)) { + foreach (const WindowQuad &quad, data.quads) { + if (quad.type() != WindowQuadDecoration) + continue; + for (int i = 0; i < 4; i++) { if (rect[i].contains(QPoint(quad.originalLeft(), quad.originalTop()))) { quads[i].append(quad);