- Reset the current loop count when the loop count sets.
- Do not trigger the animation finished callback if StopAnimation is called.
- Fix Coverity issue
Change-Id: I1db350c6d9daae37429f2c3573902f0d68a19f94
// Stop
DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
// Stop
DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
- // Trigger count is 1 - animation finished
- DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+ application.Render( 16 );
map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
value = map.Find( DevelImageVisual::Property::CURRENT_FRAME_NUMBER );
}
case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR:
{
}
case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR:
{
- int32_t stopBehavior;
- Scripting::GetEnumerationProperty( value, STOP_BEHAVIOR_TABLE, STOP_BEHAVIOR_TABLE_COUNT, stopBehavior );
- mStopBehavior = DevelImageVisual::StopBehavior::Type( stopBehavior );
- mResendFlag |= RESEND_STOP_BEHAVIOR;
+ int32_t stopBehavior = mStopBehavior;
+ if( Scripting::GetEnumerationProperty( value, STOP_BEHAVIOR_TABLE, STOP_BEHAVIOR_TABLE_COUNT, stopBehavior ) )
+ {
+ mStopBehavior = DevelImageVisual::StopBehavior::Type( stopBehavior );
+ mResendFlag |= RESEND_STOP_BEHAVIOR;
+ }
break;
}
case Toolkit::DevelImageVisual::Property::LOOPING_MODE:
{
break;
}
case Toolkit::DevelImageVisual::Property::LOOPING_MODE:
{
- int32_t loopingMode;
- Scripting::GetEnumerationProperty( value, LOOPING_MODE_TABLE, LOOPING_MODE_TABLE_COUNT, loopingMode );
- mLoopingMode = DevelImageVisual::LoopingMode::Type( loopingMode );
- mResendFlag |= RESEND_LOOPING_MODE;
+ int32_t loopingMode = mLoopingMode;
+ if( Scripting::GetEnumerationProperty( value, LOOPING_MODE_TABLE, LOOPING_MODE_TABLE_COUNT, loopingMode ) )
+ {
+ mLoopingMode = DevelImageVisual::LoopingMode::Type( loopingMode );
+ mResendFlag |= RESEND_LOOPING_MODE;
+ }
if( mVectorRasterizeThread.GetPlayState() != DevelImageVisual::PlayState::STOPPED )
{
mVectorRasterizeThread.StopAnimation();
if( mVectorRasterizeThread.GetPlayState() != DevelImageVisual::PlayState::STOPPED )
{
mVectorRasterizeThread.StopAnimation();
+ if( mImpl->mRenderer )
+ {
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
break;
}
mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
break;
}
void AnimatedVectorImageVisual::OnAnimationFinished()
{
void AnimatedVectorImageVisual::OnAnimationFinished()
{
- if( mImpl->mEventObserver )
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnAnimationFinished: action state = %d [%p]\n", mActionStatus, this );
+
+ if( mActionStatus != DevelAnimatedVectorImageVisual::Action::STOP )
- mImpl->mEventObserver->NotifyVisualEvent( *this, DevelAnimatedVectorImageVisual::Signal::ANIMATION_FINISHED );
- }
+ mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
- mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
+ if( mImpl->mEventObserver )
+ {
+ mImpl->mEventObserver->NotifyVisualEvent( *this, DevelAnimatedVectorImageVisual::Signal::ANIMATION_FINISHED );
+ }
+ }
Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_VECTOR_ANIMATION" );
#endif
Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_VECTOR_ANIMATION" );
#endif
-inline void ResetValue( bool& updated, uint32_t& value, uint32_t newValue, ConditionalWait& conditionalWait )
+template< typename T >
+inline void ResetValue( bool& updated, T& value, T newValue, ConditionalWait& conditionalWait )
{
ConditionalWait::ScopedLock lock( conditionalWait );
if( !updated )
{
ConditionalWait::ScopedLock lock( conditionalWait );
if( !updated )
mDestroyThread( false ),
mResourceReady( false ),
mCurrentFrameUpdated( false ),
mDestroyThread( false ),
mResourceReady( false ),
mCurrentFrameUpdated( false ),
+ mCurrentLoopUpdated( false ),
mForward( true ),
mUpdateFrameNumber( false ),
mForward( true ),
mUpdateFrameNumber( false ),
+ mNeedAnimationFinishedTrigger( true ),
mLogFactory( Dali::Adaptor::Get().GetLogFactory() )
{
Initialize();
mLogFactory( Dali::Adaptor::Get().GetLogFactory() )
{
Initialize();
if( mPlayState != PlayState::STOPPED && mPlayState != PlayState::STOPPING )
{
mNeedRender = true;
if( mPlayState != PlayState::STOPPED && mPlayState != PlayState::STOPPING )
{
mNeedRender = true;
+ mNeedAnimationFinishedTrigger = false;
mPlayState = PlayState::STOPPING;
mConditionalWait.Notify( lock );
mPlayState = PlayState::STOPPING;
mConditionalWait.Notify( lock );
ConditionalWait::ScopedLock lock( mConditionalWait );
mLoopCount = count;
ConditionalWait::ScopedLock lock( mConditionalWait );
mLoopCount = count;
+ mCurrentLoop = 0;
+ mCurrentLoopUpdated = true;
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetLoopCount: [%d] [%p]\n", count, this );
}
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetLoopCount: [%d] [%p]\n", count, this );
}
void VectorRasterizeThread::Rasterize()
{
void VectorRasterizeThread::Rasterize()
{
+ bool stopped = false, needAnimationFinishedTrigger;
uint32_t currentFrame, startFrame, endFrame;
uint32_t currentFrame, startFrame, endFrame;
+ int32_t loopCount, currentLoopCount;
{
ConditionalWait::ScopedLock lock( mConditionalWait );
{
ConditionalWait::ScopedLock lock( mConditionalWait );
startFrame = mStartFrame;
endFrame = mEndFrame;
loopCount = mLoopCount;
startFrame = mStartFrame;
endFrame = mEndFrame;
loopCount = mLoopCount;
+ currentLoopCount = mCurrentLoop;
+ needAnimationFinishedTrigger = mNeedAnimationFinishedTrigger;
mResourceReady = true;
mNeedRender = false;
mCurrentFrameUpdated = false;
mResourceReady = true;
mNeedRender = false;
mCurrentFrameUpdated = false;
+ mCurrentLoopUpdated = false;
mUpdateFrameNumber = true;
mUpdateFrameNumber = true;
+ mNeedAnimationFinishedTrigger = true;
}
auto currentFrameStartTime = std::chrono::system_clock::now();
}
auto currentFrameStartTime = std::chrono::system_clock::now();
- if( loopCount < 0 || ++mCurrentLoop < loopCount ) // repeat forever or before the last loop
+ if( loopCount < 0 || ++currentLoopCount < loopCount ) // repeat forever or before the last loop
{
ResetValue( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait ); // If the current frame is changed in the event thread, don't overwrite it.
mUpdateFrameNumber = false;
{
ResetValue( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait ); // If the current frame is changed in the event thread, don't overwrite it.
mUpdateFrameNumber = false;
{
animationFinished = true; // end of animation
}
{
animationFinished = true; // end of animation
}
+ ResetValue( mCurrentLoopUpdated, mCurrentLoop, currentLoopCount, mConditionalWait );
}
}
else if( currentFrame == startFrame && !mForward ) // first frame
{
}
}
else if( currentFrame == startFrame && !mForward ) // first frame
{
- if( loopCount < 0 || ++mCurrentLoop < loopCount ) // repeat forever or before the last loop
+ if( loopCount < 0 || ++currentLoopCount < loopCount ) // repeat forever or before the last loop
{
animationFinished = true; // end of animation
}
{
animationFinished = true; // end of animation
}
+ ResetValue( mCurrentLoopUpdated, mCurrentLoop, currentLoopCount, mConditionalWait );
}
if( animationFinished )
}
if( animationFinished )
mCurrentLoop = 0;
// Animation is finished
mCurrentLoop = 0;
// Animation is finished
- mAnimationFinishedTrigger->Trigger();
+ if( needAnimationFinishedTrigger )
+ {
+ mAnimationFinishedTrigger->Trigger();
+ }
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished [current = %d] [%p]\n", currentFrame, this );
}
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished [current = %d] [%p]\n", currentFrame, this );
}
bool mDestroyThread; ///< Whether the thread be destroyed
bool mResourceReady;
bool mCurrentFrameUpdated;
bool mDestroyThread; ///< Whether the thread be destroyed
bool mResourceReady;
bool mCurrentFrameUpdated;
+ bool mCurrentLoopUpdated;
bool mForward;
bool mUpdateFrameNumber;
bool mForward;
bool mUpdateFrameNumber;
+ bool mNeedAnimationFinishedTrigger;
const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
};
const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
};