Don't cache the window pixmap, it doesn't make any difference.
svn path=/branches/work/kwin_composite/; revision=593445
This commit is contained in:
parent
fb73a2070a
commit
b1a526960f
3 changed files with 18 additions and 29 deletions
|
@ -147,9 +147,9 @@ void SceneOpenGL::paint( QRegion, ToplevelList windows )
|
||||||
foreach( Window* w2, phase2 )
|
foreach( Window* w2, phase2 )
|
||||||
{
|
{
|
||||||
Window& w = *w2;
|
Window& w = *w2;
|
||||||
|
w.bindTexture();
|
||||||
glEnable( GL_BLEND );
|
glEnable( GL_BLEND );
|
||||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
w.bindTexture();
|
|
||||||
w.draw();
|
w.draw();
|
||||||
glDisable( GL_BLEND );
|
glDisable( GL_BLEND );
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,6 @@ void SceneOpenGL::windowGeometryShapeChanged( Toplevel* c )
|
||||||
return; // by default
|
return; // by default
|
||||||
Window& w = windows[ c ];
|
Window& w = windows[ c ];
|
||||||
w.discardShape();
|
w.discardShape();
|
||||||
w.discardPixmap();
|
|
||||||
w.discardTexture();
|
w.discardTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +191,6 @@ void SceneOpenGL::windowOpacityChanged( Toplevel* )
|
||||||
if( !windows.contains( c )) // this is ok, texture is created
|
if( !windows.contains( c )) // this is ok, texture is created
|
||||||
return; // on demand
|
return; // on demand
|
||||||
Window& w = windows[ c ];
|
Window& w = windows[ c ];
|
||||||
w.discardPixmap();
|
|
||||||
w.discardTexture();
|
w.discardTexture();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -206,8 +204,7 @@ void SceneOpenGL::updateTransformation( Toplevel* )
|
||||||
|
|
||||||
SceneOpenGL::Window::Window( Toplevel* c )
|
SceneOpenGL::Window::Window( Toplevel* c )
|
||||||
: toplevel( c )
|
: toplevel( c )
|
||||||
, glxpixmap( None )
|
, texture( 0 )
|
||||||
, texture( None )
|
|
||||||
, shape_valid( false )
|
, shape_valid( false )
|
||||||
, depth( 0 )
|
, depth( 0 )
|
||||||
{
|
{
|
||||||
|
@ -219,18 +216,9 @@ SceneOpenGL::Window::~Window()
|
||||||
|
|
||||||
void SceneOpenGL::Window::free()
|
void SceneOpenGL::Window::free()
|
||||||
{
|
{
|
||||||
discardPixmap();
|
|
||||||
discardTexture();
|
discardTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLXPixmap SceneOpenGL::Window::glxPixmap() const
|
|
||||||
{
|
|
||||||
if( glxpixmap == None )
|
|
||||||
glxpixmap = glXCreatePixmap( display(), fbcdrawable,
|
|
||||||
toplevel->windowPixmap(), NULL );
|
|
||||||
return glxpixmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
// for relative window positioning
|
// for relative window positioning
|
||||||
void SceneOpenGL::Window::setDepth( int d )
|
void SceneOpenGL::Window::setDepth( int d )
|
||||||
{
|
{
|
||||||
|
@ -239,7 +227,14 @@ void SceneOpenGL::Window::setDepth( int d )
|
||||||
|
|
||||||
void SceneOpenGL::Window::bindTexture()
|
void SceneOpenGL::Window::bindTexture()
|
||||||
{
|
{
|
||||||
GLXDrawable pixmap = glxPixmap();
|
if( texture != 0 && toplevel->damage().isEmpty())
|
||||||
|
{
|
||||||
|
// texture doesn't need updating, just bind it
|
||||||
|
glBindTexture( GL_TEXTURE_RECTANGLE_ARB, texture );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GLXDrawable pixmap = glXCreatePixmap( display(), fbcdrawable,
|
||||||
|
toplevel->windowPixmap(), NULL );
|
||||||
glXMakeContextCurrent( display(), pixmap, pixmap, context );
|
glXMakeContextCurrent( display(), pixmap, pixmap, context );
|
||||||
glReadBuffer( GL_FRONT );
|
glReadBuffer( GL_FRONT );
|
||||||
glDrawBuffer( GL_FRONT );
|
glDrawBuffer( GL_FRONT );
|
||||||
|
@ -264,6 +259,11 @@ void SceneOpenGL::Window::bindTexture()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// the pixmap is no longer needed, the texture will be updated
|
||||||
|
// only when the window changes anyway, so no need to cache
|
||||||
|
// the pixmap
|
||||||
|
glXDestroyPixmap( display(), pixmap );
|
||||||
|
toplevel->resetWindowPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneOpenGL::Window::discardShape()
|
void SceneOpenGL::Window::discardShape()
|
||||||
|
|
|
@ -60,16 +60,13 @@ class SceneOpenGL::Window
|
||||||
void draw();
|
void draw();
|
||||||
bool isVisible() const;
|
bool isVisible() const;
|
||||||
bool isOpaque() const;
|
bool isOpaque() const;
|
||||||
GLXPixmap glxPixmap() const;
|
|
||||||
void bindTexture();
|
void bindTexture();
|
||||||
QRegion shape() const;
|
QRegion shape() const;
|
||||||
void discardPixmap();
|
|
||||||
void discardTexture();
|
void discardTexture();
|
||||||
void discardShape();
|
void discardShape();
|
||||||
Window() {} // QMap sucks even in Qt4
|
Window() {} // QMap sucks even in Qt4
|
||||||
private:
|
private:
|
||||||
Toplevel* toplevel;
|
Toplevel* toplevel;
|
||||||
mutable GLXPixmap glxpixmap;
|
|
||||||
Texture texture;
|
Texture texture;
|
||||||
mutable QRegion shape_region;
|
mutable QRegion shape_region;
|
||||||
mutable bool shape_valid;
|
mutable bool shape_valid;
|
||||||
|
@ -100,20 +97,12 @@ int SceneOpenGL::Window::height() const
|
||||||
return toplevel->height();
|
return toplevel->height();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
void SceneOpenGL::Window::discardPixmap()
|
|
||||||
{
|
|
||||||
if( glxpixmap != None )
|
|
||||||
glXDestroyPixmap( display(), glxpixmap );
|
|
||||||
glxpixmap = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
void SceneOpenGL::Window::discardTexture()
|
void SceneOpenGL::Window::discardTexture()
|
||||||
{
|
{
|
||||||
if( texture != None )
|
if( texture != 0 )
|
||||||
glDeleteTextures( 1, &texture );
|
glDeleteTextures( 1, &texture );
|
||||||
texture = None;
|
texture = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -54,6 +54,7 @@ class Toplevel
|
||||||
bool isUtility() const;
|
bool isUtility() const;
|
||||||
|
|
||||||
Pixmap windowPixmap() const;
|
Pixmap windowPixmap() const;
|
||||||
|
void resetWindowPixmap();
|
||||||
Visual* visual() const;
|
Visual* visual() const;
|
||||||
bool shape() const;
|
bool shape() const;
|
||||||
virtual double opacity() const = 0;
|
virtual double opacity() const = 0;
|
||||||
|
@ -67,7 +68,6 @@ class Toplevel
|
||||||
protected:
|
protected:
|
||||||
void setHandle( Window id );
|
void setHandle( Window id );
|
||||||
void detectShape( Window id );
|
void detectShape( Window id );
|
||||||
void resetWindowPixmap();
|
|
||||||
void damageNotifyEvent( XDamageNotifyEvent* e );
|
void damageNotifyEvent( XDamageNotifyEvent* e );
|
||||||
QRect geom;
|
QRect geom;
|
||||||
Visual* vis;
|
Visual* vis;
|
||||||
|
|
Loading…
Reference in a new issue