[Tizen](Vector) Ensure the current frame is not out of the play range 76/220476/1
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 18 Dec 2019 10:55:57 +0000 (19:55 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 18 Dec 2019 10:55:57 +0000 (19:55 +0900)
Change-Id: I7077b0de7133f4282b66d2c4de2a1ce6b8555256

dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp

index a0e1356..ef8a18e 100644 (file)
@@ -40,6 +40,8 @@ namespace
 constexpr auto LOOP_FOREVER = -1;
 constexpr auto NANOSECONDS_PER_SECOND( 1e+9 );
 
+#define CLAMP( x, low, high ) ( ( ( x ) > ( high ) ) ? ( high ) : ( ( ( x ) < ( low ) ) ? ( low ) : ( x ) ) )
+
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_VECTOR_ANIMATION" );
 #endif
@@ -376,6 +378,7 @@ bool VectorAnimationTask::Rasterize()
     if( mPlayState == PlayState::PLAYING && mUpdateFrameNumber )
     {
       mCurrentFrame = mForward ? mCurrentFrame + 1 : mCurrentFrame - 1;
+      mCurrentFrame = CLAMP( mCurrentFrame, mStartFrame, mEndFrame );
     }
 
     currentFrame = mCurrentFrame;