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
icc-effect-5.14.5
Luboš Luňák 2006-10-07 21:18:36 +00:00
parent e194246f73
commit 06203d0652
11 changed files with 13 additions and 87 deletions

View File

@ -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()

View File

@ -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());
}
}

View File

@ -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());

View File

@ -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 )

View File

@ -42,14 +42,6 @@ void Scene::windowDeleted( Toplevel* )
{
}
void Scene::transformWindowDamage( Toplevel*, QRegion& ) const
{
}
void Scene::updateTransformation( Toplevel* )
{
}
Scene* scene;
} // namespace

View File

@ -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;
};

View File

@ -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 )

View File

@ -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;

View File

@ -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 ))

View File

@ -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 );

View File

@ -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();