[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
This commit is contained in:
parent
7ee83dc5e4
commit
709b7c2c58
1 changed files with 2 additions and 16 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue