From 548eb09a74db922c19bfc87bd65f06e71d1a511b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 24 Oct 2006 13:38:31 +0000 Subject: [PATCH] Move shared code to base class. svn path=/branches/work/kwin_composite/; revision=598752 --- scene.cpp | 15 +++++++++++++++ scene.h | 1 + scene_opengl.cpp | 12 ++---------- scene_xrender.cpp | 12 ++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/scene.cpp b/scene.cpp index 4d4f86813b..d780a5659f 100644 --- a/scene.cpp +++ b/scene.cpp @@ -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* ) { // nothing, no changes diff --git a/scene.h b/scene.h index 1222b22406..16775f8f3c 100644 --- a/scene.h +++ b/scene.h @@ -46,6 +46,7 @@ class Scene PAINT_SCREEN_TRANSFORMED = 1 << 4 }; protected: + void paintScreen( int* mask, QRegion* region ); virtual void paintGenericScreen( int mask, ScreenPaintData data ); virtual void paintSimpleScreen( int mask, QRegion region ); virtual void paintBackground( QRegion region ) = 0; diff --git a/scene_opengl.cpp b/scene_opengl.cpp index d151099ba6..968308790b 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -277,16 +277,8 @@ void SceneOpenGL::paint( QRegion damage, ToplevelList toplevels ) glClear( GL_COLOR_BUFFER_BIT ); glScalef( 1, -1, 1 ); glTranslatef( 0, -displayHeight(), 0 ); - int mask = ( damage == QRegion( 0, 0, displayWidth(), displayHeight())) - ? 0 : PAINT_SCREEN_REGION; - 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 ); + int mask = 0; + paintScreen( &mask, &damage ); stacking_order.clear(); glPopMatrix(); // TODO only partial repaint for mask & PAINT_SCREEN_REGION diff --git a/scene_xrender.cpp b/scene_xrender.cpp index caefb8e8a7..32fb34acd0 100644 --- a/scene_xrender.cpp +++ b/scene_xrender.cpp @@ -84,16 +84,8 @@ void SceneXrender::paint( QRegion damage, ToplevelList toplevels ) assert( windows.contains( c )); stacking_order.append( &windows[ c ] ); } - int mask = ( damage == QRegion( 0, 0, displayWidth(), displayHeight())) - ? 0 : PAINT_SCREEN_REGION; - 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 ); + int mask = 0; + paintScreen( &mask, &damage ); stacking_order.clear(); if( mask & PAINT_SCREEN_REGION ) {