From 8518a7ea8c3971e27702aac00ea33e39520c6571 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 14 Nov 2021 16:26:49 +0200 Subject: [PATCH] Drop Scene::Window::windowTexture() --- src/scene.h | 4 ---- src/scenes/opengl/scene_opengl.cpp | 38 ------------------------------ src/scenes/opengl/scene_opengl.h | 1 - 3 files changed, 43 deletions(-) diff --git a/src/scene.h b/src/scene.h index c3f796bd46..9ad3dab089 100644 --- a/src/scene.h +++ b/src/scene.h @@ -316,10 +316,6 @@ public: SurfaceItem *surfaceItem() const; ShadowItem *shadowItem() const; - virtual QSharedPointer windowTexture() { - return {}; - } - protected: Toplevel* toplevel; private: diff --git a/src/scenes/opengl/scene_opengl.cpp b/src/scenes/opengl/scene_opengl.cpp index 8091362022..c5c1a6e1d2 100644 --- a/src/scenes/opengl/scene_opengl.cpp +++ b/src/scenes/opengl/scene_opengl.cpp @@ -933,44 +933,6 @@ void OpenGLWindow::performPaint(int mask, const QRegion ®ion, const WindowPai } } -QSharedPointer OpenGLWindow::windowTexture() -{ - OpenGLSurfaceTexture *frame = nullptr; - const SurfaceItem *item = surfaceItem(); - - if (item && item->pixmap()) { - frame = static_cast(item->pixmap()->texture()); - } - - if (frame && item->childItems().isEmpty() && frame->texture()) { - return QSharedPointer(new GLTexture(*frame->texture())); - } else { - auto effectWindow = window()->effectWindow(); - const QRect virtualGeometry = window()->bufferGeometry(); - QSharedPointer texture(new GLTexture(GL_RGBA8, virtualGeometry.size() * window()->bufferScale())); - - QScopedPointer framebuffer(new KWin::GLRenderTarget(*texture)); - GLRenderTarget::pushRenderTarget(framebuffer.data()); - - auto renderVSG = GLRenderTarget::virtualScreenGeometry(); - const QRect outputGeometry = { virtualGeometry.topLeft(), texture->size() }; - GLVertexBuffer::setVirtualScreenGeometry(outputGeometry); - GLRenderTarget::setVirtualScreenGeometry(outputGeometry); - - QMatrix4x4 mvp; - mvp.ortho(virtualGeometry.x(), virtualGeometry.x() + virtualGeometry.width(), virtualGeometry.y(), virtualGeometry.y() + virtualGeometry.height(), -1, 1); - - WindowPaintData data(effectWindow); - data.setProjectionMatrix(mvp); - - performPaint(Scene::PAINT_WINDOW_TRANSFORMED, outputGeometry, data); - GLRenderTarget::popRenderTarget(); - GLVertexBuffer::setVirtualScreenGeometry(renderVSG); - GLRenderTarget::setVirtualScreenGeometry(renderVSG); - return texture; - } -} - //**************************************** // SceneOpenGL::EffectFrame //**************************************** diff --git a/src/scenes/opengl/scene_opengl.h b/src/scenes/opengl/scene_opengl.h index 5c3ab1302b..79636c7beb 100644 --- a/src/scenes/opengl/scene_opengl.h +++ b/src/scenes/opengl/scene_opengl.h @@ -120,7 +120,6 @@ public: ~OpenGLWindow() override; void performPaint(int mask, const QRegion ®ion, const WindowPaintData &data) override; - QSharedPointer windowTexture() override; private: QMatrix4x4 modelViewProjectionMatrix(int mask, const WindowPaintData &data) const;