(Vector) Fix frame drop bug
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / animated-vector-image / vector-animation-task.cpp
index 2f29ac0..86a37ab 100644 (file)
@@ -254,9 +254,8 @@ void VectorAnimationTask::SetPlayRange(const Property::Array& playRange)
     std::string marker;
     if(playRange.GetElementAt(0).Get(marker))
     {
-      if(mVectorRenderer)
+      if(mVectorRenderer && mVectorRenderer.GetMarkerInfo(marker, startFrame, endFrame))
       {
-        mVectorRenderer.GetMarkerInfo(marker, startFrame, endFrame);
         valid = true;
       }
     }
@@ -524,15 +523,16 @@ uint32_t VectorAnimationTask::GetStoppedFrame(uint32_t startFrame, uint32_t endF
 
 VectorAnimationTask::TimePoint VectorAnimationTask::CalculateNextFrameTime(bool renderNow)
 {
-  // std::chrono::time_point template has second parameter duration which defaults to the std::chrono::system_clock supported
+  // std::chrono::time_point template has second parameter duration which defaults to the std::chrono::steady_clock supported
   // duration. In some C++11 implementations it is a milliseconds duration, so it fails to compile unless mNextFrameStartTime
   // is casted to use the default duration.
   mNextFrameStartTime = std::chrono::time_point_cast<TimePoint::duration>(mNextFrameStartTime + std::chrono::microseconds(mFrameDurationMicroSeconds));
-  auto current        = std::chrono::system_clock::now();
+  auto current        = std::chrono::steady_clock::now();
+  mDroppedFrames      = 0;
+
   if(renderNow)
   {
     mNextFrameStartTime = current;
-    mDroppedFrames      = 0;
   }
   else if(mNextFrameStartTime < current)
   {