From 295477c4ad90c1d468d2ff4e00eb75c11fb9d931 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Tue, 27 Mar 2007 14:15:41 +0000 Subject: [PATCH] Try to load the data in prePaintWindow() instead of paintWindow() if it's not loaded yet. This way we won't request the window to be painted when loading fails or has failed. Also remove 2 lines of obsolete code. svn path=/branches/work/kwin_composite/; revision=647139 --- effects/explosioneffect.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/effects/explosioneffect.cpp b/effects/explosioneffect.cpp index 2ac551945c..4c93cec4bd 100644 --- a/effects/explosioneffect.cpp +++ b/effects/explosioneffect.cpp @@ -97,18 +97,24 @@ void ExplosionEffect::prePaintWindow( EffectWindow* w, int* mask, QRegion* paint { if( mWindows.contains( w )) { - mWindows[ w ] += time / 700.0; // complete change in 700ms - if( mWindows[ w ] < 1 ) + SceneOpenGL::Window* glwin = dynamic_cast< SceneOpenGL::Window* >( w->sceneWindow() ); + if( mValid && glwin && !mInited ) + mValid = loadData(); + if( mValid ) { - *mask |= Scene::PAINT_WINDOW_TRANSLUCENT | Scene::PAINT_WINDOW_TRANSFORMED; - *mask &= ~Scene::PAINT_WINDOW_OPAQUE; - w->enablePainting( Scene::Window::PAINT_DISABLED_BY_DELETE ); - } - else - { - mWindows.remove( w ); - static_cast< Deleted* >( w->window())->unrefWindow(); - mActiveAnimations--; + mWindows[ w ] += time / 700.0; // complete change in 700ms + if( mWindows[ w ] < 1 ) + { + *mask |= Scene::PAINT_WINDOW_TRANSLUCENT | Scene::PAINT_WINDOW_TRANSFORMED; + *mask &= ~Scene::PAINT_WINDOW_OPAQUE; + w->enablePainting( Scene::Window::PAINT_DISABLED_BY_DELETE ); + } + else + { + mWindows.remove( w ); + static_cast< Deleted* >( w->window())->unrefWindow(); + mActiveAnimations--; + } } } @@ -120,15 +126,11 @@ void ExplosionEffect::paintWindow( EffectWindow* w, int mask, QRegion region, Wi // Make sure we have OpenGL compositing and the window is vidible and not a // special window SceneOpenGL::Window* glwin = dynamic_cast< SceneOpenGL::Window* >( w->sceneWindow() ); - //Client* c = qobject_cast< Client* >( w->window() ); bool useshader = ( mValid && glwin && mWindows.contains( w ) ); - if( useshader && !mInited ) - useshader = mValid = loadData(); if( useshader ) { float maxscaleadd = 1.5f; float scale = 1 + maxscaleadd*mWindows[w]; - //data.xTranslate = (f - 1)* data.xScale = scale; data.yScale = scale; data.xTranslate += int( w->window()->width() / 2 * ( 1 - scale ));