From 4c814590fe822248068ac65362e2c44b2876300c Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 3 Mar 2022 17:46:19 +0100 Subject: [PATCH] Fix textureForOutput for the EglWaylandBackend Ensure we get our texture from the right output --- src/backends/wayland/egl_wayland_backend.cpp | 11 +++++++++++ src/backends/wayland/egl_wayland_backend.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/backends/wayland/egl_wayland_backend.cpp b/src/backends/wayland/egl_wayland_backend.cpp index 51d71546d7..f9a3ec53fa 100644 --- a/src/backends/wayland/egl_wayland_backend.cpp +++ b/src/backends/wayland/egl_wayland_backend.cpp @@ -309,6 +309,17 @@ static QVector regionToRects(const QRegion ®ion, AbstractWaylandOutpu return rects; } + +QSharedPointer EglWaylandBackend::textureForOutput(KWin::AbstractOutput *output) const +{ + QSharedPointer texture(new GLTexture(GL_RGBA8, output->pixelSize())); + GLRenderTarget::pushRenderTarget(m_outputs[output]->renderTarget()); + GLRenderTarget renderTarget(texture.data()); + renderTarget.blitFromFramebuffer(QRect(0, texture->height(), texture->width(), -texture->height())); + GLRenderTarget::popRenderTarget(); + return texture; +} + void EglWaylandBackend::aboutToStartPainting(AbstractOutput *output, const QRegion &damagedRegion) { Q_ASSERT_X(output, "aboutToStartPainting", "not using per screen rendering"); diff --git a/src/backends/wayland/egl_wayland_backend.h b/src/backends/wayland/egl_wayland_backend.h index 6496a93dbd..3d04ff1a02 100644 --- a/src/backends/wayland/egl_wayland_backend.h +++ b/src/backends/wayland/egl_wayland_backend.h @@ -83,6 +83,7 @@ public: return m_havePlatformBase; } + QSharedPointer textureForOutput(KWin::AbstractOutput *output) const override; void aboutToStartPainting(AbstractOutput *output, const QRegion &damage) override; private: