X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-image%2Fanimated-image-visual.cpp;h=5a83d9219bfc1d13738fbc99ff2d5d29a4823d0e;hp=745c45c743ef9a783addc208a9d907ad1dbfef95;hb=e3ca2d8166cf74b2b0072ce491e9a4275a98b1cc;hpb=6ecc4c026c8e398c1a13cba2584c62092f4cf014 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..5a83d92 100755 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp @@ -510,6 +510,7 @@ void AnimatedImageVisual::DoSetOffScene( Actor& actor ) actor.RemoveRenderer( mImpl->mRenderer ); mImpl->mRenderer.Reset(); mPlacementActor.Reset(); + mStartFirstFrame = false; } void AnimatedImageVisual::OnSetTransform() @@ -608,12 +609,13 @@ void AnimatedImageVisual::StartFirstFrame( TextureSet& textureSet ) if(mImpl->mRenderer) { mImpl->mRenderer.SetTextures( textureSet ); - } - Actor actor = mPlacementActor.GetHandle(); - if( actor ) - { - actor.AddRenderer( mImpl->mRenderer ); - mPlacementActor.Reset(); + + Actor actor = mPlacementActor.GetHandle(); + if( actor ) + { + actor.AddRenderer( mImpl->mRenderer ); + mPlacementActor.Reset(); + } } if( mFrameCount > 1 ) @@ -687,69 +689,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 ) - { - frameIndex = 0; - } - else if( mStopBehavior == DevelImageVisual::StopBehavior::LAST_FRAME ) + bool nextFrame = false; + uint32_t frameIndex = mImageCache->GetCurrentFrameIndex(); + + if( mIsJumpTo ) { - frameIndex = mFrameCount - 1; + mIsJumpTo = false; + frameIndex = mFrameIndexForJumpTo; } - else + else if( mActionStatus == DevelAnimatedImageVisual::Action::PAUSE ) { - return false; // Do not draw already rendered scene twice. + return false; } - } - else - { - if( mFrameCount > 1 ) + else if( mActionStatus == DevelAnimatedImageVisual::Action::STOP ) { - 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 ) { - // This will stop timer - mActionStatus = DevelAnimatedImageVisual::Action::STOP; - return DisplayNextFrame(); + frameIndex = mFrameCount - 1; + } + else + { + 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(); @@ -762,11 +766,16 @@ bool AnimatedImageVisual::DisplayNextFrame() if( textureSet ) { SetImageSize( textureSet ); - mImpl->mRenderer.SetTextures( textureSet ); + if( mImpl->mRenderer ) + { + mImpl->mRenderer.SetTextures( textureSet ); + } } + + continueTimer = ( mActionStatus == DevelAnimatedImageVisual::Action::PLAY ) ? true : false; } - return ( mActionStatus == DevelAnimatedImageVisual::Action::PLAY ) ? true : false; + return continueTimer; }