Drop EffectsHandler::renderScreen()
It's no longer relevant after merging libkwin and libkwineffects. By dropping EffectsHandler::renderScreen() and making the screen transform use the Scene API directly, we can clean up some OpenGL context handling code.
This commit is contained in:
parent
6a997b41ae
commit
62f904b698
3 changed files with 24 additions and 36 deletions
|
@ -1569,23 +1569,6 @@ Output *EffectsHandler::findScreen(int screenId) const
|
|||
return Workspace::self()->outputs().value(screenId);
|
||||
}
|
||||
|
||||
void EffectsHandler::renderScreen(Output *output)
|
||||
{
|
||||
Q_ASSERT(effects->isOpenGLCompositing());
|
||||
|
||||
RenderLayer layer(output->renderLoop());
|
||||
SceneDelegate delegate(m_scene, output);
|
||||
delegate.setLayer(&layer);
|
||||
|
||||
m_scene->prePaint(&delegate);
|
||||
|
||||
effects->makeOpenGLContextCurrent(); // TODO: doesn't belong here, but there's no better place atm either
|
||||
RenderTarget renderTarget(GLFramebuffer::currentFramebuffer());
|
||||
m_scene->paint(renderTarget, output->geometry());
|
||||
|
||||
m_scene->postPaint();
|
||||
}
|
||||
|
||||
bool EffectsHandler::isCursorHidden() const
|
||||
{
|
||||
return Cursors::self()->isCursorHidden();
|
||||
|
|
|
@ -718,11 +718,6 @@ public:
|
|||
Output *findScreen(const QString &name) const;
|
||||
Output *findScreen(int screenId) const;
|
||||
|
||||
/**
|
||||
* Renders @p screen in the current render target
|
||||
*/
|
||||
void renderScreen(Output *screen);
|
||||
|
||||
KWin::EffectWindow *inputPanel() const;
|
||||
bool isInputPanelOverlay() const;
|
||||
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
*/
|
||||
// own
|
||||
#include "screentransform.h"
|
||||
#include "core/renderlayer.h"
|
||||
#include "core/rendertarget.h"
|
||||
#include "core/renderviewport.h"
|
||||
#include "effect/effecthandler.h"
|
||||
#include "opengl/glutils.h"
|
||||
#include "scene/workspacescene.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -81,24 +83,32 @@ void ScreenTransformEffect::addScreen(Output *screen)
|
|||
effects->addRepaintFull();
|
||||
});
|
||||
connect(screen, &Output::aboutToChange, this, [this, screen] {
|
||||
Scene *scene = effects->scene();
|
||||
|
||||
RenderLayer layer(screen->renderLoop());
|
||||
SceneDelegate delegate(scene, screen);
|
||||
delegate.setLayer(&layer);
|
||||
|
||||
scene->prePaint(&delegate);
|
||||
|
||||
effects->makeOpenGLContextCurrent();
|
||||
auto &state = m_states[screen];
|
||||
state.m_oldTransform = screen->transform();
|
||||
state.m_oldGeometry = screen->geometry();
|
||||
state.m_prev.texture = GLTexture::allocate(GL_RGBA8, screen->geometry().size() * screen->scale());
|
||||
if (!state.m_prev.texture) {
|
||||
if (auto texture = GLTexture::allocate(GL_RGBA8, screen->geometry().size() * screen->scale())) {
|
||||
auto &state = m_states[screen];
|
||||
state.m_oldTransform = screen->transform();
|
||||
state.m_oldGeometry = screen->geometry();
|
||||
state.m_prev.texture = std::move(texture);
|
||||
state.m_prev.framebuffer = std::make_unique<GLFramebuffer>(state.m_prev.texture.get());
|
||||
|
||||
RenderTarget renderTarget(state.m_prev.framebuffer.get());
|
||||
scene->paint(renderTarget, screen->geometry());
|
||||
|
||||
// Now, the effect can cross-fade between current and previous state.
|
||||
state.m_captured = true;
|
||||
} else {
|
||||
m_states.remove(screen);
|
||||
return;
|
||||
}
|
||||
state.m_prev.framebuffer = std::make_unique<GLFramebuffer>(state.m_prev.texture.get());
|
||||
|
||||
// Rendering the current scene into a texture
|
||||
GLFramebuffer::pushFramebuffer(state.m_prev.framebuffer.get());
|
||||
effects->renderScreen(screen);
|
||||
GLFramebuffer::popFramebuffer();
|
||||
|
||||
// Now, the effect can cross-fade between current and previous state.
|
||||
state.m_captured = true;
|
||||
scene->postPaint();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue