From: Adeel Kazmi Date: Tue, 15 Dec 2020 21:24:45 +0000 (+0000) Subject: Fix SVACE error in animated-image-visual.cpp X-Git-Tag: dali_2.0.6~6^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=91308e03ecec8f9d4ef86114b9a05272e4476a9d;hp=6ecc4c026c8e398c1a13cba2584c62092f4cf014;ds=sidebyside Fix SVACE error in animated-image-visual.cpp Change-Id: I688715d694f5a726cebb95c1a69bf051177b4085 --- diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp index 745c45c..cb900a4 100755 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp @@ -687,69 +687,71 @@ void AnimatedImageVisual::FrameReady( TextureSet textureSet ) bool AnimatedImageVisual::DisplayNextFrame() { - bool nextFrame = false; - uint32_t frameIndex = mImageCache->GetCurrentFrameIndex(); + bool continueTimer = false; - if( mIsJumpTo ) + if(mImageCache) { - mIsJumpTo = false; - frameIndex = mFrameIndexForJumpTo; - } - else if( mActionStatus == DevelAnimatedImageVisual::Action::PAUSE ) - { - return false; - } - else if( mActionStatus == DevelAnimatedImageVisual::Action::STOP ) - { - frameIndex = 0; - if( mStopBehavior == DevelImageVisual::StopBehavior::FIRST_FRAME ) + bool nextFrame = false; + uint32_t frameIndex = mImageCache->GetCurrentFrameIndex(); + + if( mIsJumpTo ) { - frameIndex = 0; + mIsJumpTo = false; + frameIndex = mFrameIndexForJumpTo; } - else if( mStopBehavior == DevelImageVisual::StopBehavior::LAST_FRAME ) + else if( mActionStatus == DevelAnimatedImageVisual::Action::PAUSE ) { - frameIndex = mFrameCount - 1; + return false; } - else + else if( mActionStatus == DevelAnimatedImageVisual::Action::STOP ) { - return false; // Do not draw already rendered scene twice. - } - } - else - { - if( mFrameCount > 1 ) - { - nextFrame = true; - frameIndex++; - if( frameIndex >= mFrameCount ) + frameIndex = 0; + if( mStopBehavior == DevelImageVisual::StopBehavior::FIRST_FRAME ) { - frameIndex %= mFrameCount; - ++mCurrentLoopIndex; + frameIndex = 0; } - - if(mLoopCount >= 0 && mCurrentLoopIndex >= mLoopCount) + else if( mStopBehavior == DevelImageVisual::StopBehavior::LAST_FRAME ) + { + frameIndex = mFrameCount - 1; + } + else { - // This will stop timer - mActionStatus = DevelAnimatedImageVisual::Action::STOP; - return DisplayNextFrame(); + return false; // Do not draw already rendered scene twice. } } - - unsigned int delay = mImageCache->GetFrameInterval( frameIndex ); - if( delay > 0u ) + else { - if( mFrameDelayTimer.GetInterval() != delay ) + if( mFrameCount > 1 ) + { + nextFrame = true; + frameIndex++; + if( frameIndex >= mFrameCount ) + { + frameIndex %= mFrameCount; + ++mCurrentLoopIndex; + } + + if(mLoopCount >= 0 && mCurrentLoopIndex >= mLoopCount) + { + // This will stop timer + mActionStatus = DevelAnimatedImageVisual::Action::STOP; + return DisplayNextFrame(); + } + } + + unsigned int delay = mImageCache->GetFrameInterval( frameIndex ); + if( delay > 0u ) { - mFrameDelayTimer.SetInterval( delay ); + if( mFrameDelayTimer.GetInterval() != delay ) + { + mFrameDelayTimer.SetInterval( delay ); + } } } - } - DALI_LOG_INFO( gAnimImgLogFilter,Debug::Concise,"AnimatedImageVisual::DisplayNextFrame(this:%p) CurrentFrameIndex:%d\n", this, frameIndex); + DALI_LOG_INFO( gAnimImgLogFilter,Debug::Concise,"AnimatedImageVisual::DisplayNextFrame(this:%p) CurrentFrameIndex:%d\n", this, frameIndex); - TextureSet textureSet; - if( mImageCache ) - { + TextureSet textureSet; if(nextFrame) { textureSet = mImageCache->NextFrame(); @@ -764,9 +766,11 @@ bool AnimatedImageVisual::DisplayNextFrame() SetImageSize( textureSet ); mImpl->mRenderer.SetTextures( textureSet ); } + + continueTimer = ( mActionStatus == DevelAnimatedImageVisual::Action::PLAY ) ? true : false; } - return ( mActionStatus == DevelAnimatedImageVisual::Action::PLAY ) ? true : false; + return continueTimer; }