Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 709b7c2c authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[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
parent 7ee83dc5
......@@ -1099,23 +1099,9 @@ void GLRenderTarget::pushRenderTargets(QStack <GLRenderTarget*> 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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment