Prevent jerkiness of the first two frames of the logout blur effect by
starting the animation after the render target has been created. svn path=/trunk/KDE/kdebase/workspace/; revision=1030718
This commit is contained in:
parent
53986fa859
commit
4d1bdd5a63
2 changed files with 17 additions and 5 deletions
|
@ -63,6 +63,7 @@ LogoutEffect::~LogoutEffect()
|
||||||
void LogoutEffect::reconfigure( ReconfigureFlags )
|
void LogoutEffect::reconfigure( ReconfigureFlags )
|
||||||
{
|
{
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
||||||
|
frameDelay = 0;
|
||||||
KConfigGroup conf = effects->effectConfig( "Logout" );
|
KConfigGroup conf = effects->effectConfig( "Logout" );
|
||||||
useBlur = conf.readEntry( "UseBlur", true );
|
useBlur = conf.readEntry( "UseBlur", true );
|
||||||
delete blurTexture;
|
delete blurTexture;
|
||||||
|
@ -102,14 +103,24 @@ void LogoutEffect::prePaintScreen( ScreenPrePaintData& data, int time )
|
||||||
blurTarget = new GLRenderTarget( blurTexture );
|
blurTarget = new GLRenderTarget( blurTexture );
|
||||||
if( blurTarget->valid() )
|
if( blurTarget->valid() )
|
||||||
blurSupported = true;
|
blurSupported = true;
|
||||||
|
|
||||||
|
// As creating the render target takes time it can cause the first two frames of the
|
||||||
|
// blur animation to be jerky. For this reason we only start the animation after the
|
||||||
|
// third frame.
|
||||||
|
frameDelay = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( logoutWindow != NULL && !logoutWindowClosed )
|
if( frameDelay )
|
||||||
progress = qMin( 1.0, progress + time / animationTime( 2000.0 ));
|
--frameDelay;
|
||||||
else if( progress > 0.0 )
|
else
|
||||||
progress = qMax( 0.0, progress - time / animationTime( 500.0 ));
|
{
|
||||||
|
if( logoutWindow != NULL && !logoutWindowClosed )
|
||||||
|
progress = qMin( 1.0, progress + time / animationTime( 2000.0 ));
|
||||||
|
else if( progress > 0.0 )
|
||||||
|
progress = qMax( 0.0, progress - time / animationTime( 500.0 ));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
||||||
if( blurSupported && progress > 0.0 )
|
if( blurSupported && progress > 0.0 )
|
||||||
|
@ -222,7 +233,7 @@ void LogoutEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data
|
||||||
|
|
||||||
void LogoutEffect::postPaintScreen()
|
void LogoutEffect::postPaintScreen()
|
||||||
{
|
{
|
||||||
if( progress != 0.0 && progress != 1.0 )
|
if(( progress != 0.0 && progress != 1.0 ) || frameDelay )
|
||||||
{
|
{
|
||||||
effects->addRepaintFull();
|
effects->addRepaintFull();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ class LogoutEffect
|
||||||
bool logoutWindowPassed;
|
bool logoutWindowPassed;
|
||||||
|
|
||||||
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
|
||||||
|
int frameDelay;
|
||||||
bool blurSupported, useBlur;
|
bool blurSupported, useBlur;
|
||||||
GLTexture* blurTexture;
|
GLTexture* blurTexture;
|
||||||
GLRenderTarget* blurTarget;
|
GLRenderTarget* blurTarget;
|
||||||
|
|
Loading…
Reference in a new issue