From 0bb1f2e7bf35c8191432e49cf439dd198bf750b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 9 Sep 2016 09:41:05 +0200 Subject: [PATCH] Make WindowPixmap::isValid virtual and override in concrete implementation Summary: If a buffer gets destroyed the texture created from it is still valid. In such a situation the OpenGLWindowPixmap should return true for isValid and not false as it did. Similar in QPainter compositor the pixmap is valid if there is an image copied from the buffer. This change ensures that for example minimizing an XWayland window still has a texture during the minimize animation. BUG: 368440 Test Plan: Minimize animation plays for X windows and minimized windows are shown in present windows. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2724 --- scene.h | 2 +- scene_opengl.cpp | 8 ++++++++ scene_opengl.h | 1 + scene_qpainter.cpp | 8 ++++++++ scene_qpainter.h | 1 + 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scene.h b/scene.h index d16ed95bee..a1a1b684c3 100644 --- a/scene.h +++ b/scene.h @@ -362,7 +362,7 @@ public: /** * @return @c true if the pixmap has been created and is valid, @c false otherwise */ - bool isValid() const; + virtual bool isValid() const; /** * @return The native X11 pixmap handle */ diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 0118999bf6..c8ce5db210 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1740,6 +1740,14 @@ WindowPixmap *OpenGLWindowPixmap::createChild(const QPointerisNull()) { + return true; + } + return WindowPixmap::isValid(); +} + //**************************************** // SceneOpenGL::EffectFrame //**************************************** diff --git a/scene_opengl.h b/scene_opengl.h index 716203839d..1fe20912c0 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -275,6 +275,7 @@ public: virtual ~OpenGLWindowPixmap(); SceneOpenGL::Texture *texture() const; bool bind(); + bool isValid() const override; protected: WindowPixmap *createChild(const QPointer &subSurface) override; private: diff --git a/scene_qpainter.cpp b/scene_qpainter.cpp index ae55b62088..feccf6223d 100644 --- a/scene_qpainter.cpp +++ b/scene_qpainter.cpp @@ -490,6 +490,14 @@ void QPainterWindowPixmap::updateBuffer() } } +bool QPainterWindowPixmap::isValid() const +{ + if (!m_image.isNull()) { + return true; + } + return WindowPixmap::isValid(); +} + QPainterEffectFrame::QPainterEffectFrame(EffectFrameImpl *frame, SceneQPainter *scene) : Scene::EffectFrame(frame) , m_scene(scene) diff --git a/scene_qpainter.h b/scene_qpainter.h index 439e790743..0c82bc15d7 100644 --- a/scene_qpainter.h +++ b/scene_qpainter.h @@ -163,6 +163,7 @@ public: explicit QPainterWindowPixmap(Scene::Window *window); virtual ~QPainterWindowPixmap(); virtual void create() override; + bool isValid() const override; void updateBuffer() override; const QImage &image();