From 2fa320c9b8bc6feb65aa763bd8be1ea4e262615f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 27 Nov 2006 16:16:34 +0000 Subject: [PATCH] Clearing of the whole buffer is not necessary anymore, at least not in the simple cases. Improves drawing performance. svn path=/branches/work/kwin_composite/; revision=608458 --- scene_opengl.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 70b99c488a..4bc082c620 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -443,8 +443,6 @@ void SceneOpenGL::paint( QRegion damage, ToplevelList toplevels ) grabXServer(); glXWaitX(); glPushMatrix(); - glClearColor( 0, 0, 0, 1 ); - glClear( GL_COLOR_BUFFER_BIT ); int mask = 0; paintScreen( &mask, &damage ); // call generic implementation glPopMatrix(); @@ -540,9 +538,26 @@ void SceneOpenGL::paintGenericScreen( int mask, ScreenPaintData data ) glPopMatrix(); } -void SceneOpenGL::paintBackground( QRegion ) +void SceneOpenGL::paintBackground( QRegion region ) { -// TODO? + if( region == infiniteRegion()) + { + glClearColor( 1, 1, 1, 1 ); // white + glClear( GL_COLOR_BUFFER_BIT ); + } + else + { + glColor4f( 1, 1, 1, 1 ); // white + glBegin( GL_QUADS ); + foreach( QRect r, region.rects()) + { + glVertex2i( r.x(), r.y()); + glVertex2i( r.x() + r.width(), r.y()); + glVertex2i( r.x() + r.width(), r.y() + r.height()); + glVertex2i( r.x(), r.y() + r.height()); + } + glEnd(); + } } void SceneOpenGL::windowAdded( Toplevel* c )