// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.h>
+#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-manager.h>
namespace Dali
{
: mUrl( url ),
mVectorRenderer(),
mAnimationData(),
- mVectorAnimationThread( factoryCache.GetVectorAnimationThread() ),
+ mVectorAnimationThread( factoryCache.GetVectorAnimationManager().GetVectorAnimationThread() ),
mConditionalWait(),
mAnimationFinishedTrigger(),
mPlayState( PlayState::STOPPED ),
mAnimationDataIndex( 0 ),
mLoopCount( LOOP_FOREVER ),
mCurrentLoop( 0 ),
- mResourceReady( false ),
mForward( true ),
mUpdateFrameNumber( false ),
mNeedAnimationFinishedTrigger( true ),
- mAnimationDataUpdated( false )
+ mAnimationDataUpdated( false ),
+ mDestroyTask( false )
{
Initialize();
}
}
mVectorRenderer.Finalize();
+
+ mDestroyTask = true;
}
void VectorAnimationTask::SetRenderer( Renderer renderer )
mWidth = width;
mHeight = height;
- mResourceReady = false;
-
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetSize: width = %d, height = %d [%p]\n", width, height, this );
}
}
{
if( mPlayState != PlayState::PLAYING )
{
+ mNeedAnimationFinishedTrigger = true;
mUpdateFrameNumber = false;
mPlayState = PlayState::PLAYING;
if( mStartFrame > mCurrentFrame )
{
mCurrentFrame = mStartFrame;
- mResourceReady = false;
}
else if( mEndFrame < mCurrentFrame )
{
mCurrentFrame = mEndFrame;
- mResourceReady = false;
}
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetPlayRange: [%d, %d] [%p]\n", mStartFrame, mEndFrame, this );
{
mCurrentFrame = frameNumber;
mUpdateFrameNumber = false;
- mResourceReady = false;
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::SetCurrentFrameNumber: frame number = %d [%p]\n", mCurrentFrame, this );
}
bool stopped = false;
uint32_t currentFrame;
+ {
+ ConditionalWait::ScopedLock lock( mConditionalWait );
+ if( mDestroyTask )
+ {
+ // The task will be destroyed. We don't need rasterization.
+ return false;
+ }
+ }
+
ApplyAnimationData();
if( mPlayState == PlayState::PLAYING && mUpdateFrameNumber )
currentFrame = mCurrentFrame;
- // Reset values
- mResourceReady = true;
mUpdateFrameNumber = true;
- mNeedAnimationFinishedTrigger = true;
if( mPlayState == PlayState::STOPPING )
{
{
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationTask::Rasterize: Rendering failed. Try again later.[%d] [%p]\n", currentFrame, this );
mUpdateFrameNumber = false;
-
- if( !mResourceReady )
- {
- mResourceReady = false;
- }
}
}