Move shared code to base class.

svn path=/branches/work/kwin_composite/; revision=598752
This commit is contained in:
Luboš Luňák 2006-10-24 13:38:31 +00:00
parent 189ca6c3a2
commit 548eb09a74
4 changed files with 20 additions and 20 deletions

View file

@ -41,6 +41,21 @@ Scene::~Scene()
{ {
} }
// returns mask and possibly modified region
void Scene::paintScreen( int* mask, QRegion* region )
{
*mask = ( *region == QRegion( 0, 0, displayWidth(), displayHeight()))
? 0 : PAINT_SCREEN_REGION;
WrapperEffect wrapper;
// preparation step
effects->prePaintScreen( mask, region, &wrapper );
if( *mask & ( PAINT_SCREEN_TRANSFORMED | PAINT_WINDOW_TRANSFORMED ))
*mask &= ~PAINT_SCREEN_REGION;
// TODO call also prePaintWindow() for all windows
ScreenPaintData data;
effects->paintScreen( *mask, *region, data, &wrapper );
}
void Scene::WrapperEffect::prePaintScreen( int*, QRegion* ) void Scene::WrapperEffect::prePaintScreen( int*, QRegion* )
{ {
// nothing, no changes // nothing, no changes

View file

@ -46,6 +46,7 @@ class Scene
PAINT_SCREEN_TRANSFORMED = 1 << 4 PAINT_SCREEN_TRANSFORMED = 1 << 4
}; };
protected: protected:
void paintScreen( int* mask, QRegion* region );
virtual void paintGenericScreen( int mask, ScreenPaintData data ); virtual void paintGenericScreen( int mask, ScreenPaintData data );
virtual void paintSimpleScreen( int mask, QRegion region ); virtual void paintSimpleScreen( int mask, QRegion region );
virtual void paintBackground( QRegion region ) = 0; virtual void paintBackground( QRegion region ) = 0;

View file

@ -277,16 +277,8 @@ void SceneOpenGL::paint( QRegion damage, ToplevelList toplevels )
glClear( GL_COLOR_BUFFER_BIT ); glClear( GL_COLOR_BUFFER_BIT );
glScalef( 1, -1, 1 ); glScalef( 1, -1, 1 );
glTranslatef( 0, -displayHeight(), 0 ); glTranslatef( 0, -displayHeight(), 0 );
int mask = ( damage == QRegion( 0, 0, displayWidth(), displayHeight())) int mask = 0;
? 0 : PAINT_SCREEN_REGION; paintScreen( &mask, &damage );
WrapperEffect wrapper;
// preparation step
effects->prePaintScreen( &mask, &damage, &wrapper );
if( mask & ( PAINT_SCREEN_TRANSFORMED | PAINT_WINDOW_TRANSFORMED ))
mask &= ~PAINT_SCREEN_REGION;
// TODO call also prePaintWindow() for all windows
ScreenPaintData data;
effects->paintScreen( mask, damage, data, &wrapper );
stacking_order.clear(); stacking_order.clear();
glPopMatrix(); glPopMatrix();
// TODO only partial repaint for mask & PAINT_SCREEN_REGION // TODO only partial repaint for mask & PAINT_SCREEN_REGION

View file

@ -84,16 +84,8 @@ void SceneXrender::paint( QRegion damage, ToplevelList toplevels )
assert( windows.contains( c )); assert( windows.contains( c ));
stacking_order.append( &windows[ c ] ); stacking_order.append( &windows[ c ] );
} }
int mask = ( damage == QRegion( 0, 0, displayWidth(), displayHeight())) int mask = 0;
? 0 : PAINT_SCREEN_REGION; paintScreen( &mask, &damage );
WrapperEffect wrapper;
// preparation step
effects->prePaintScreen( &mask, &damage, &wrapper );
if( mask & ( PAINT_SCREEN_TRANSFORMED | PAINT_WINDOW_TRANSFORMED ))
mask &= ~PAINT_SCREEN_REGION;
// TODO call also prePaintWindow() for all windows
ScreenPaintData data;
effects->paintScreen( mask, damage, data, &wrapper );
stacking_order.clear(); stacking_order.clear();
if( mask & PAINT_SCREEN_REGION ) if( mask & PAINT_SCREEN_REGION )
{ {