Make sure to unbind the texture in tfp_mode when the underlying pixmap

is discarded.  Windows that have previously been mapped and unmapped now
update properly when mapped again.


svn path=/trunk/KDE/kdebase/workspace/; revision=683977
icc-effect-5.14.5
Philip Falkner 2007-07-05 19:59:55 +00:00
parent 913d8395d8
commit c2ff6a4d7a
6 changed files with 28 additions and 10 deletions

View File

@ -407,6 +407,8 @@ void Toplevel::discardWindowPixmap()
return;
XFreePixmap( display(), window_pix );
window_pix = None;
if( effectWindow() != NULL && effectWindow()->sceneWindow() != NULL )
effectWindow()->sceneWindow()->pixmapDiscarded();
}
Pixmap Toplevel::createWindowPixmap()

View File

@ -1082,7 +1082,6 @@ void EffectWindowImpl::setShader(GLShader* shader)
EffectWindow* effectWindow( Toplevel* w )
{
EffectWindowImpl* ret = w->effectWindow();
ret->setSceneWindow( NULL ); // just in case
return ret;
}

View File

@ -131,6 +131,8 @@ class Scene::Window
// perform the actual painting of the window
virtual void performPaint( int mask, QRegion region, WindowPaintData data ) = 0;
virtual void prepareForPainting() {}
// do any cleanup needed when the window's composite pixmap is discarded
virtual void pixmapDiscarded() {}
int x() const;
int y() const;
int width() const;

View File

@ -691,6 +691,7 @@ void SceneOpenGL::windowClosed( Toplevel* c, Deleted* deleted )
else
{
delete windows.take( c );
c->effectWindow()->setSceneWindow( NULL );
}
}
@ -698,6 +699,7 @@ void SceneOpenGL::windowDeleted( Deleted* c )
{
assert( windows.contains( c ));
delete windows.take( c );
c->effectWindow()->setSceneWindow( NULL );
}
void SceneOpenGL::windowGeometryShapeChanged( Toplevel* c )
@ -749,18 +751,21 @@ void SceneOpenGL::Texture::init()
void SceneOpenGL::Texture::discard()
{
if( mTexture != None )
{
if( tfp_mode )
{
if( !options->glStrictBinding )
glXReleaseTexImageEXT( display(), bound_glxpixmap, GLX_FRONT_LEFT_EXT );
glXDestroyGLXPixmap( display(), bound_glxpixmap );
bound_glxpixmap = None;
}
}
release();
GLTexture::discard();
}
void SceneOpenGL::Texture::release()
{
if( tfp_mode && bound_glxpixmap != None )
{
if( !options->glStrictBinding )
glXReleaseTexImageEXT( display(), bound_glxpixmap, GLX_FRONT_LEFT_EXT );
glXDestroyGLXPixmap( display(), bound_glxpixmap );
bound_glxpixmap = None;
}
}
void SceneOpenGL::Texture::findTarget()
{
unsigned int new_target = 0;
@ -1183,6 +1188,12 @@ void SceneOpenGL::Window::discardVertices()
currentYResolution = -1;
}
// when the window's composite pixmap is discarded, undo binding it to the texture
void SceneOpenGL::Window::pixmapDiscarded()
{
texture.release();
}
// paint the window
void SceneOpenGL::Window::performPaint( int mask, QRegion region, WindowPaintData data )
{

View File

@ -98,6 +98,7 @@ class SceneOpenGL::Texture
virtual bool load( const QImage& image, GLenum target = GL_TEXTURE_2D );
virtual bool load( const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D );
virtual void discard();
virtual void release(); // undo the tfp_mode binding
virtual void bind();
virtual void unbind();
@ -119,6 +120,7 @@ class SceneOpenGL::Window
virtual ~Window();
virtual void performPaint( int mask, QRegion region, WindowPaintData data );
virtual void prepareForPainting();
virtual void pixmapDiscarded();
bool bindTexture();
void discardTexture();
void discardVertices();

View File

@ -287,6 +287,7 @@ void SceneXrender::windowClosed( Toplevel* c, Deleted* deleted )
else
{
delete windows.take( c );
c->effectWindow()->setSceneWindow( NULL );
}
}
@ -294,6 +295,7 @@ void SceneXrender::windowDeleted( Deleted* c )
{
assert( windows.contains( c ));
delete windows.take( c );
c->effectWindow()->setSceneWindow( NULL );
}
void SceneXrender::windowAdded( Toplevel* c )