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
icc-effect-5.14.5
Martin Gräßlin 2016-09-09 09:41:05 +02:00
parent cdcee88b48
commit 0bb1f2e7bf
5 changed files with 19 additions and 1 deletions

View File

@ -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
*/

View File

@ -1740,6 +1740,14 @@ WindowPixmap *OpenGLWindowPixmap::createChild(const QPointer<KWayland::Server::S
return new OpenGLWindowPixmap(subSurface, this, m_scene);
}
bool OpenGLWindowPixmap::isValid() const
{
if (!m_texture->isNull()) {
return true;
}
return WindowPixmap::isValid();
}
//****************************************
// SceneOpenGL::EffectFrame
//****************************************

View File

@ -275,6 +275,7 @@ public:
virtual ~OpenGLWindowPixmap();
SceneOpenGL::Texture *texture() const;
bool bind();
bool isValid() const override;
protected:
WindowPixmap *createChild(const QPointer<KWayland::Server::SubSurfaceInterface> &subSurface) override;
private:

View File

@ -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)

View File

@ -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();