From b168c3538457c9d1529c7c64a76302e6c8441ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sat, 7 Oct 2006 21:20:23 +0000 Subject: [PATCH] Don't cache window pixmap, it's used only after it changes. svn path=/branches/work/kwin_composite/; revision=593453 --- effects.cpp | 4 ++-- events.cpp | 1 - geometry.cpp | 2 -- scene_basic.cpp | 4 +++- scene_opengl.cpp | 5 +++-- scene_xrender.cpp | 11 ++++++++++- toplevel.cpp | 2 -- toplevel.h | 4 +--- unmanaged.cpp | 1 - 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/effects.cpp b/effects.cpp index 8058ef5109..e9ddd8612e 100644 --- a/effects.cpp +++ b/effects.cpp @@ -274,8 +274,8 @@ EffectsHandler::EffectsHandler( Workspace* ws ) { if( !compositing()) return; - mht = new MakeHalfTransparent; - sm = new ShakyMove; +// mht = new MakeHalfTransparent; +// sm = new ShakyMove; // gm = new GrowMove; // swu = new ShiftWorkspaceUp( ws ); } diff --git a/events.cpp b/events.cpp index fca5bdf39e..2ed9e46747 100644 --- a/events.cpp +++ b/events.cpp @@ -1653,7 +1653,6 @@ void Unmanaged::unmapNotifyEvent( XUnmapEvent* ) void Unmanaged::configureNotifyEvent( XConfigureEvent* e ) { - resetWindowPixmap(); // TODO add damage only if the window is not obscured workspace()->addDamage( geometry()); geom = QRect( e->x, e->y, e->width, e->height ); diff --git a/geometry.cpp b/geometry.cpp index 40f154e593..0020a2849f 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1686,7 +1686,6 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); - resetWindowPixmap(); addDamage( rect()); } @@ -1743,7 +1742,6 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) sendSyntheticConfigureNotify(); updateWindowRules(); checkMaximizeGeometry(); - resetWindowPixmap(); // TODO add damage only in added area? addDamage( rect()); } diff --git a/scene_basic.cpp b/scene_basic.cpp index c1dff73041..c237074d85 100644 --- a/scene_basic.cpp +++ b/scene_basic.cpp @@ -44,8 +44,10 @@ void SceneBasic::paint( QRegion, ToplevelList windows ) QRect r = (*it)->geometry().intersect( QRect( 0, 0, displayWidth(), displayHeight())); if( !r.isEmpty()) { - XCopyArea( display(), (*it)->windowPixmap(), composite_pixmap, gc, + Pixmap pix = (*it)->createWindowPixmap(); + XCopyArea( display(), pix, composite_pixmap, gc, qMax( 0, -(*it)->x()), qMax( 0, -(*it)->y()), r.width(), r.height(), r.x(), r.y()); + XFreePixmap( display(), pix ); } } XCopyArea( display(), composite_pixmap, rootWindow(), gc, 0, 0, displayWidth(), displayHeight(), 0, 0 ); diff --git a/scene_opengl.cpp b/scene_opengl.cpp index e18485228b..f2b1add65e 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -226,7 +226,8 @@ void SceneOpenGL::Window::bindTexture() glBindTexture( GL_TEXTURE_RECTANGLE_ARB, texture ); return; } - Pixmap pix = toplevel->windowPixmap(); + Pixmap window_pix = toplevel->createWindowPixmap(); + Pixmap pix = window_pix; // HACK // When a window uses ARGB visual and has a decoration, the decoration // does use ARGB visual. When converting such window to a texture @@ -304,7 +305,7 @@ void SceneOpenGL::Window::bindTexture() // only when the window changes anyway, so no need to cache // the pixmap glXDestroyPixmap( display(), pixmap ); - toplevel->resetWindowPixmap(); + XFreePixmap( display(), window_pix ); #ifdef ALPHA_CLEAR_COPY if( alpha_clear ) XFreePixmap( display(), pix ); diff --git a/scene_xrender.cpp b/scene_xrender.cpp index 7fdff29344..c7a0848768 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -295,8 +295,17 @@ bool SceneXrender::WindowData::simpleTransformation() const Picture SceneXrender::WindowData::picture() { + if( !window->damage().isEmpty() && _picture != None ) + { + XRenderFreePicture( display(), _picture ); + _picture = None; + } if( _picture == None && format != NULL ) - _picture = XRenderCreatePicture( display(), window->windowPixmap(), format, 0, 0 ); + { + Pixmap pix = window->createWindowPixmap(); + _picture = XRenderCreatePicture( display(), pix, format, 0, 0 ); + XFreePixmap( display(), pix ); // the picture owns the pixmap + } return _picture; } diff --git a/toplevel.cpp b/toplevel.cpp index 879479bd26..f9c1eac435 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -18,7 +18,6 @@ Toplevel::Toplevel( Workspace* ws ) , id( None ) , wspace( ws ) , damage_handle( None ) - , window_pixmap( None ) , is_shape( false ) { } @@ -26,7 +25,6 @@ Toplevel::Toplevel( Workspace* ws ) Toplevel::~Toplevel() { assert( damage_handle == None ); - assert( window_pixmap == None ); } #ifndef NDEBUG diff --git a/toplevel.h b/toplevel.h index 61ca988a00..71c8dc2eb0 100644 --- a/toplevel.h +++ b/toplevel.h @@ -53,8 +53,7 @@ class Toplevel bool isSplash() const; bool isUtility() const; - Pixmap windowPixmap() const; - void resetWindowPixmap(); + Pixmap createWindowPixmap() const; Visual* visual() const; bool shape() const; virtual double opacity() const = 0; @@ -79,7 +78,6 @@ class Toplevel Workspace* wspace; Damage damage_handle; QRegion damage_region; - mutable Pixmap window_pixmap; bool is_shape; }; diff --git a/unmanaged.cpp b/unmanaged.cpp index c8c81d0615..9a1a38ac7d 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -54,7 +54,6 @@ bool Unmanaged::track( Window w ) XShapeSelectInput( display(), w, ShapeNotifyMask ); detectShape( w ); setupCompositing(); - resetWindowPixmap(); return true; }