From 709b7c2c58f5f0bd11d344e0e499d6b0434ec31c Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Sun, 1 Jul 2018 13:28:05 +0300 Subject: [PATCH] [libkwineffects] Push render targets more efficiently in GLRenderTarget::pushRenderTargets Summary: If s_renderTargets is not empty, GLRenderTarget::pushRenderTargets starts to do pretty heavy things: it deletes head of the targets param in a while loop. There is no need to do that. Because QStack inherits QVector, we can use append method to push new render targets in a more efficient way. Test Plan: Background behind Konsole is still blurred. Reviewers: #kwin, mart Reviewed By: #kwin, mart Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13823 --- libkwineffects/kwinglutils.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 84bb73bebc..5dbcc54f01 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -1099,23 +1099,9 @@ void GLRenderTarget::pushRenderTargets(QStack targets) { if (s_renderTargets.isEmpty()) { glGetIntegerv(GL_VIEWPORT, s_virtualScreenViewport); - s_renderTargets = targets; - } else { - s_renderTargets.reserve(s_renderTargets.size() + targets.size()); - - /* - * Merging the two stacks. - * We cheat a little bit by using the inherited QVector functions. - * This is to not have the targets stack in reverse order without - * having to use a helper QStack first to reverse the order. - */ - while (!targets.isEmpty()) { - s_renderTargets.push(targets.first()); - targets.removeFirst(); - } } - - s_renderTargets.top()->enable(); + targets.top()->enable(); + s_renderTargets.append(targets); } GLRenderTarget* GLRenderTarget::popRenderTarget()