diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 0d047ce4fb..4b70830b3f 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -394,6 +394,11 @@ bool GLTexture::isNull() const return mTexture == None; } +QSize GLTexture::size() const + { + return mSize; + } + bool GLTexture::load( const QImage& image, GLenum target ) { if( image.isNull()) diff --git a/lib/kwinglutils.h b/lib/kwinglutils.h index 96ed9037c7..6c43d08cc4 100644 --- a/lib/kwinglutils.h +++ b/lib/kwinglutils.h @@ -113,6 +113,7 @@ class KWIN_EXPORT GLTexture virtual ~GLTexture(); bool isNull() const; + QSize size() const; virtual bool load( const QImage& image, GLenum target = GL_TEXTURE_2D ); virtual bool load( const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D ); diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 821b36071e..f13c9f091e 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -781,7 +781,7 @@ void SceneOpenGL::windowGeometryShapeChanged( Toplevel* c ) return; // by default Window* w = windows[ c ]; w->discardShape(); - w->discardTexture(); + w->checkTextureSize(); } void SceneOpenGL::windowOpacityChanged( Toplevel* ) @@ -1159,6 +1159,18 @@ void SceneOpenGL::Window::discardTexture() texture.discard(); } +// This call is used in SceneOpenGL::windowGeometryShapeChanged(), +// which originally called discardTexture(), however this was causing performance +// problems with the launch feedback icon - large number of texture rebinds. +// Since the launch feedback icon does not resize, only changes shape, it +// is not necessary to rebind the texture (with no strict binding), therefore +// discard the texture only if size changes. +void SceneOpenGL::Window::checkTextureSize() + { + if( texture.size() != size()) + discardTexture(); + } + // when the window's composite pixmap is discarded, undo binding it to the texture void SceneOpenGL::Window::pixmapDiscarded() { diff --git a/scene_opengl.h b/scene_opengl.h index 92afe0f7c2..401ff4aca5 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -132,6 +132,7 @@ class SceneOpenGL::Window virtual void pixmapDiscarded(); bool bindTexture(); void discardTexture(); + void checkTextureSize(); protected: void renderQuads( int mask, const QRegion& region, const WindowQuadList& quads );