X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-vector-image%2Fvector-animation-task.cpp;h=bb6fb7e2531ba5f4091417bc6f8f16e2f4c3e470;hb=175d74ab98dd2f89726ce6594a08d65e0d01056f;hp=7cfce6b9a89bee91d2bf806906345284ae9d0e82;hpb=e396a42c0185be1331eddb5569b84968fb1510f3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp index 7cfce6b..bb6fb7e 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include // INTERNAL INCLUDES #include @@ -115,11 +116,71 @@ void VectorAnimationTask::SetRenderer( Renderer renderer ) DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetRenderer [%p]\n", this ); } +void VectorAnimationTask::SetAnimationData( const AnimationData& data ) +{ + ConditionalWait::ScopedLock lock( mConditionalWait ); + + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetAnimationData [%p]\n", this ); + + if( data.resendFlag & VectorAnimationTask::RESEND_LOOP_COUNT ) + { + SetLoopCount( data.loopCount ); + } + + if( data.resendFlag & VectorAnimationTask::RESEND_PLAY_RANGE ) + { + SetPlayRange( data.playRange ); + } + + if( data.resendFlag & VectorAnimationTask::RESEND_STOP_BEHAVIOR ) + { + SetStopBehavior( data.stopBehavior ); + } + + if( data.resendFlag & VectorAnimationTask::RESEND_LOOPING_MODE ) + { + SetLoopingMode( data.loopingMode ); + } + + if( data.resendFlag & VectorAnimationTask::RESEND_CURRENT_FRAME ) + { + SetCurrentFrameNumber( data.currentFrame ); + } + + if( data.resendFlag & VectorAnimationTask::RESEND_SIZE ) + { + SetSize( data.width, data.height ); + } + + if( data.resendFlag & VectorAnimationTask::RESEND_PLAY_STATE ) + { + if( data.playState == DevelImageVisual::PlayState::PLAYING ) + { + PlayAnimation(); + } + else if( data.playState == DevelImageVisual::PlayState::PAUSED ) + { + PauseAnimation(); + RenderFrame(); + } + else if( data.playState == DevelImageVisual::PlayState::STOPPED ) + { + StopAnimation(); + } + } + else + { + if( mPlayState == PlayState::PAUSED || mPlayState == PlayState::STOPPED ) + { + RenderFrame(); + } + } +} + void VectorAnimationTask::SetSize( uint32_t width, uint32_t height ) { if( mWidth != width || mHeight != height ) { - ConditionalWait::ScopedLock lock( mConditionalWait ); mVectorRenderer.SetSize( width, height ); mWidth = width; @@ -133,8 +194,6 @@ void VectorAnimationTask::SetSize( uint32_t width, uint32_t height ) void VectorAnimationTask::PlayAnimation() { - ConditionalWait::ScopedLock lock( mConditionalWait ); - if( mPlayState != PlayState::PLAYING ) { mUpdateFrameNumber = false; @@ -148,7 +207,6 @@ void VectorAnimationTask::PlayAnimation() void VectorAnimationTask::StopAnimation() { - ConditionalWait::ScopedLock lock( mConditionalWait ); if( mPlayState != PlayState::STOPPED && mPlayState != PlayState::STOPPING ) { mNeedAnimationFinishedTrigger = false; @@ -160,7 +218,6 @@ void VectorAnimationTask::StopAnimation() void VectorAnimationTask::PauseAnimation() { - ConditionalWait::ScopedLock lock( mConditionalWait ); if( mPlayState == PlayState::PLAYING ) { mPlayState = PlayState::PAUSED; @@ -171,8 +228,6 @@ void VectorAnimationTask::PauseAnimation() void VectorAnimationTask::RenderFrame() { - ConditionalWait::ScopedLock lock( mConditionalWait ); - if( !mResourceReady ) { mVectorAnimationThread.AddTask( this ); @@ -194,8 +249,6 @@ void VectorAnimationTask::SetLoopCount( int32_t count ) { if( mLoopCount != count ) { - ConditionalWait::ScopedLock lock( mConditionalWait ); - mLoopCount = count; mCurrentLoop = 0; mCurrentLoopUpdated = true; @@ -204,10 +257,8 @@ void VectorAnimationTask::SetLoopCount( int32_t count ) } } -void VectorAnimationTask::SetPlayRange( Property::Array& playRange ) +void VectorAnimationTask::SetPlayRange( const Property::Array& playRange ) { - ConditionalWait::ScopedLock lock( mConditionalWait ); - bool valid = false; uint32_t startFrame = 0, endFrame = 0; size_t count = playRange.Count(); @@ -333,8 +384,6 @@ DevelImageVisual::PlayState::Type VectorAnimationTask::GetPlayState() const void VectorAnimationTask::SetCurrentFrameNumber( uint32_t frameNumber ) { - ConditionalWait::ScopedLock lock( mConditionalWait ); - if( mCurrentFrame == frameNumber ) { DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetCurrentFrameNumber: Set same frame [%d] [%p]\n", frameNumber, this ); @@ -374,7 +423,6 @@ void VectorAnimationTask::GetDefaultSize( uint32_t& width, uint32_t& height ) co void VectorAnimationTask::SetStopBehavior( DevelImageVisual::StopBehavior::Type stopBehavior ) { - ConditionalWait::ScopedLock lock( mConditionalWait ); mStopBehavior = stopBehavior; DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetStopBehavior: stop behavor = %d [%p]\n", mStopBehavior, this ); @@ -382,7 +430,6 @@ void VectorAnimationTask::SetStopBehavior( DevelImageVisual::StopBehavior::Type void VectorAnimationTask::SetLoopingMode( DevelImageVisual::LoopingMode::Type loopingMode ) { - ConditionalWait::ScopedLock lock( mConditionalWait ); mLoopingMode = loopingMode; DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetLoopingMode: looping mode = %d [%p]\n", mLoopingMode, this ); @@ -430,6 +477,7 @@ bool VectorAnimationTask::Rasterize() if( mPlayState == PlayState::PLAYING && mUpdateFrameNumber ) { mCurrentFrame = mForward ? mCurrentFrame + 1 : mCurrentFrame - 1; + Dali::ClampInPlace( mCurrentFrame, mStartFrame, mEndFrame ); } currentFrame = mCurrentFrame;