From 2c9dd370d999cbd9f697da41370769dfa3cd4636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 21 Nov 2006 22:22:48 +0000 Subject: [PATCH] Do not try to paint outside of the screen. svn path=/branches/work/kwin_composite/; revision=606822 --- scene.cpp | 8 ++++++-- scene_opengl.cpp | 4 +++- scene_opengl.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scene.cpp b/scene.cpp index 28282ea5cd..a9b8bd438a 100644 --- a/scene.cpp +++ b/scene.cpp @@ -111,8 +111,12 @@ void Scene::paintScreen( int* mask, QRegion* region ) *mask &= ~PAINT_SCREEN_REGION; *region = infiniteRegion(); } - else if(( *mask & PAINT_SCREEN_REGION ) == 0 ) - { // force region to be full + else if( *mask & PAINT_SCREEN_REGION ) + { // make sure not to go outside visible screen + *region &= QRegion( 0, 0, displayWidth(), displayHeight()); + } + else + { // whole screen, not transformed, force region to be full *region = QRegion( 0, 0, displayWidth(), displayHeight()); } ScreenPaintData data; diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 8850f85ac5..2fcea9a23c 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -467,8 +467,10 @@ void SceneOpenGL::waitSync() } // actually paint to the screen (double-buffer swap or copy from pixmap buffer) -void SceneOpenGL::flushBuffer( int mask, const QRegion& damage ) +void SceneOpenGL::flushBuffer( int mask, QRegion damage ) { + if( mask & PAINT_SCREEN_REGION )// make sure not to go outside visible screen + damage &= QRegion( 0, 0, displayWidth(), displayHeight()); if( db ) { if( mask & PAINT_SCREEN_REGION ) diff --git a/scene_opengl.h b/scene_opengl.h index e21b9352e5..8644ab84ea 100644 --- a/scene_opengl.h +++ b/scene_opengl.h @@ -45,7 +45,7 @@ class SceneOpenGL void initRenderingContext(); bool findConfig( const int* attrs, GLXFBConfig* config, VisualID visual = None ); void waitSync(); - void flushBuffer( int mask, const QRegion& damage ); + void flushBuffer( int mask, QRegion damage ); typedef GLuint Texture; GC gcroot; Drawable buffer;