From 06203d06529711af94c9bb072b5c58e3ac6ce62e 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:18:36 +0000 Subject: [PATCH] Don't bother with trying to transform window damage, when there are any transformations, it should simply repaint everything (todo). svn path=/branches/work/kwin_composite/; revision=593450 --- composite.cpp | 18 +----------------- effects.cpp | 13 ++++++------- events.cpp | 2 +- geometry.cpp | 8 ++++---- scene.cpp | 8 -------- scene.h | 8 +------- scene_opengl.cpp | 7 ------- scene_opengl.h | 3 --- scene_xrender.cpp | 27 --------------------------- scene_xrender.h | 2 -- workspace.h | 4 ---- 11 files changed, 13 insertions(+), 87 deletions(-) diff --git a/composite.cpp b/composite.cpp index fa8a796ebd..a70c0bb228 100644 --- a/composite.cpp +++ b/composite.cpp @@ -117,22 +117,6 @@ void Workspace::addDamage( const QRect& r ) damage_region += r; } -void Workspace::addDamage( Toplevel* c, int x, int y, int w, int h ) - { - if( !compositing()) - return; - addDamage( c, QRect( x, y, w, h )); - } - -void Workspace::addDamage( Toplevel* c, const QRect& r ) - { - if( !compositing()) - return; - QRegion r2( r ); - scene->transformWindowDamage( c, r2 ); - damage_region += r2; - } - void Workspace::compositeTimeout() { if( damage_region.isEmpty()) // no damage @@ -222,7 +206,7 @@ void Toplevel::addDamage( int x, int y, int w, int h ) // this could be possibly optimized to damage Workspace only if the toplevel // is actually visible there and not obscured by something, but I guess // that's not really worth it - workspace()->addDamage( this, r ); + workspace()->addDamage( r ); } void Toplevel::resetDamage() diff --git a/effects.cpp b/effects.cpp index 52f7dd7e90..8058ef5109 100644 --- a/effects.cpp +++ b/effects.cpp @@ -188,8 +188,8 @@ void ShakyMove::windowUserMovedResized( Toplevel* c, bool first, bool last ) else if( last ) { windows.remove( c ); - scene->updateTransformation( c ); - c->workspace()->addDamage( c, c->geometry().adjusted( -3, 7, 0, 0 )); + // TODO just damage whole screen, transformation is involved + c->workspace()->addDamage( c->geometry().adjusted( -3, 7, 0, 0 )); if( windows.isEmpty()) timer.stop(); } @@ -212,8 +212,8 @@ void ShakyMove::tick() *it = 0; else ++(*it); - scene->updateTransformation( it.key()); - it.key()->workspace()->addDamage( it.key(), it.key()->geometry().adjusted( -1, 2, 0, 0 )); + // TODO damage whole screen, transformation is involved + it.key()->workspace()->addDamage( it.key()->geometry().adjusted( -1, 2, 0, 0 )); } } @@ -233,9 +233,8 @@ void GrowMove::windowUserMovedResized( Toplevel* c, bool first, bool last ) { if( first || last ) { - c->workspace()->addDamage( c, c->geometry()); - scene->updateTransformation( c ); - c->workspace()->addDamage( c, c->geometry()); + // TODO damage whole screen, transformation is involved + c->workspace()->addDamage( c->geometry()); } } diff --git a/events.cpp b/events.cpp index 4bd27ff05f..fca5bdf39e 100644 --- a/events.cpp +++ b/events.cpp @@ -1655,7 +1655,7 @@ void Unmanaged::configureNotifyEvent( XConfigureEvent* e ) { resetWindowPixmap(); // TODO add damage only if the window is not obscured - workspace()->addDamage( this, geometry()); + workspace()->addDamage( geometry()); geom = QRect( e->x, e->y, e->width, e->height ); // TODO maybe only damage changed area addDamage( rect()); diff --git a/geometry.cpp b/geometry.cpp index 02595c9323..40f154e593 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1661,7 +1661,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force ) if( force == NormalGeometrySet && geom == QRect( x, y, w, h )) return; // TODO add damage only if not obscured - workspace()->addDamage( this, geometry()); // TODO cache the previous real geometry + workspace()->addDamage( geometry()); // TODO cache the previous real geometry geom = QRect( x, y, w, h ); updateWorkareaDiffs(); if( postpone_geometry_updates != 0 ) @@ -1719,7 +1719,7 @@ void Client::plainResize( int w, int h, ForceGeometry_t force ) } if( force == NormalGeometrySet && geom.size() == QSize( w, h )) return; - workspace()->addDamage( this, geometry()); // TODO cache the previous real geometry + workspace()->addDamage( geometry()); // TODO cache the previous real geometry geom.setSize( QSize( w, h )); updateWorkareaDiffs(); if( postpone_geometry_updates != 0 ) @@ -1755,7 +1755,7 @@ void Client::move( int x, int y, ForceGeometry_t force ) { if( force == NormalGeometrySet && geom.topLeft() == QPoint( x, y )) return; - workspace()->addDamage( this, geometry()); // TODO cache the previous real geometry + workspace()->addDamage( geometry()); // TODO cache the previous real geometry geom.moveTopLeft( QPoint( x, y )); updateWorkareaDiffs(); if( postpone_geometry_updates != 0 ) @@ -1768,7 +1768,7 @@ void Client::move( int x, int y, ForceGeometry_t force ) updateWindowRules(); checkMaximizeGeometry(); // client itself is not damaged - workspace()->addDamage( this, geometry()); + workspace()->addDamage( geometry()); } void Client::postponeGeometryUpdates( bool postpone ) diff --git a/scene.cpp b/scene.cpp index 96da1d6496..11726a8fde 100644 --- a/scene.cpp +++ b/scene.cpp @@ -42,14 +42,6 @@ void Scene::windowDeleted( Toplevel* ) { } -void Scene::transformWindowDamage( Toplevel*, QRegion& ) const - { - } - -void Scene::updateTransformation( Toplevel* ) - { - } - Scene* scene; } // namespace diff --git a/scene.h b/scene.h index 11cb8db93f..ac17d3a1c1 100644 --- a/scene.h +++ b/scene.h @@ -22,7 +22,7 @@ class Scene { public: Scene( Workspace* ws ); - virtual ~Scene(); + virtual ~Scene() = 0; // repaints the given screen areas, windows provides the stacking order virtual void paint( QRegion damage, ToplevelList windows ) = 0; // shape/size of a window changed @@ -33,12 +33,6 @@ class Scene virtual void windowAdded( Toplevel* ); // a window has been destroyed virtual void windowDeleted( Toplevel* ); - // transforms the window areas to screen areas - virtual void transformWindowDamage( Toplevel*, QRegion& ) const; - // updates cached window information after an effect changes - // transformation - // TODO - remove? - virtual void updateTransformation( Toplevel* ); protected: Workspace* wspace; }; diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 081a22189f..e18485228b 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -195,13 +195,6 @@ void SceneOpenGL::windowOpacityChanged( Toplevel* ) #endif } -void SceneOpenGL::updateTransformation( Toplevel* ) - { - // TODO this is only used in effects to later update - // screen damage - since opengl doesn't use screen - // damage, just leave this empty - } - SceneOpenGL::Window::Window( Toplevel* c ) : toplevel( c ) , texture( 0 ) diff --git a/scene_opengl.h b/scene_opengl.h index 9c9af29da4..414ebbaf11 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -31,9 +31,6 @@ class SceneOpenGL virtual void windowOpacityChanged( Toplevel* ); virtual void windowAdded( Toplevel* ); virtual void windowDeleted( Toplevel* ); -// screen damage is not used with opengl, it's completely repainted -// virtual void transformWindowDamage( Toplevel*, QRegion& ) const; - virtual void updateTransformation( Toplevel* ); private: typedef GLuint Texture; GC gcroot; diff --git a/scene_xrender.cpp b/scene_xrender.cpp index dbfe4c2eef..c9400b8ae5 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -181,33 +181,6 @@ void SceneXrender::paint( QRegion dam, ToplevelList windows ) XFixesDestroyRegion( display(), damage ); } -void SceneXrender::transformWindowDamage( Toplevel* c, QRegion& r ) const - { - if( !window_data.contains( c )) - return; - const Matrix& matrix = window_data[ c ].matrix; - if( matrix.isIdentity()) - return; - if( matrix.isOnlyTranslate()) - r.translate( int( matrix.xTranslate()), int( matrix.yTranslate())); - else - { - // The region here should be translated using the matrix, but that's not possible - // (well, maybe fetch the region and transform manually - TODO check). So simply - // mark whole screen as damaged. - r = QRegion( 0, 0, displayWidth(), displayHeight()); - } - } - -void SceneXrender::updateTransformation( Toplevel* c ) - { - // TODO maybe only mark as invalid and update on-demand - resetWindowData( c ); - WindowData& data = window_data[ c ]; - effects->transformWindow( c, data.matrix, data.effect ); - effects->transformWorkspace( data.matrix, data.effect ); - } - void SceneXrender::resetWindowData( Toplevel* c ) { if( !window_data.contains( c )) diff --git a/scene_xrender.h b/scene_xrender.h index 3b80e1fc4c..3c973a8388 100644 --- a/scene_xrender.h +++ b/scene_xrender.h @@ -35,8 +35,6 @@ class SceneXrender virtual void windowOpacityChanged( Toplevel* ); virtual void windowAdded( Toplevel* ); virtual void windowDeleted( Toplevel* ); - virtual void transformWindowDamage( Toplevel*, QRegion& ) const; - virtual void updateTransformation( Toplevel* ); private: void createBuffer(); void resetWindowData( Toplevel* c ); diff --git a/workspace.h b/workspace.h index c5a4277796..0279baf3d0 100644 --- a/workspace.h +++ b/workspace.h @@ -285,10 +285,6 @@ class Workspace : public QObject, public KDecorationDefines void addDamage( const QRect& r ); void addDamage( int x, int y, int w, int h ); - // these damage the workspace without actually damaging the contents - // of the toplevel - e.g. when the toplevel moves away from that area - void addDamage( Toplevel* c, const QRect& r ); - void addDamage( Toplevel* c, int x, int y, int w, int h ); public slots: void refresh();