// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
#include <dali/public-api/object/property-array.h>
+#include <dali/public-api/math/math-utils.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
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;
void VectorAnimationTask::PlayAnimation()
{
- ConditionalWait::ScopedLock lock( mConditionalWait );
-
if( mPlayState != PlayState::PLAYING )
{
mUpdateFrameNumber = false;
void VectorAnimationTask::StopAnimation()
{
- ConditionalWait::ScopedLock lock( mConditionalWait );
if( mPlayState != PlayState::STOPPED && mPlayState != PlayState::STOPPING )
{
mNeedAnimationFinishedTrigger = false;
void VectorAnimationTask::PauseAnimation()
{
- ConditionalWait::ScopedLock lock( mConditionalWait );
if( mPlayState == PlayState::PLAYING )
{
mPlayState = PlayState::PAUSED;
void VectorAnimationTask::RenderFrame()
{
- ConditionalWait::ScopedLock lock( mConditionalWait );
-
if( !mResourceReady )
{
mVectorAnimationThread.AddTask( this );
{
if( mLoopCount != count )
{
- ConditionalWait::ScopedLock lock( mConditionalWait );
-
mLoopCount = count;
mCurrentLoop = 0;
mCurrentLoopUpdated = true;
}
}
-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();
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 );
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 );
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 );
if( mPlayState == PlayState::PLAYING && mUpdateFrameNumber )
{
mCurrentFrame = mForward ? mCurrentFrame + 1 : mCurrentFrame - 1;
+ Dali::ClampInPlace( mCurrentFrame, mStartFrame, mEndFrame );
}
currentFrame = mCurrentFrame;