Don't discard window texture when only the shape changes but the window
geometry actually stays the same. Avoids large number of rebinds (with no strict binding) with the launch feedback icon. svn path=/trunk/KDE/kdebase/workspace/; revision=787948
This commit is contained in:
parent
fb7f6b67e1
commit
f77561ce65
4 changed files with 20 additions and 1 deletions
|
@ -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())
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue