-
- auto currentFrameStartTime = std::chrono::system_clock::now();
-
- // Rasterize
- mVectorRenderer.Render( currentFrame );
-
- if( playState == DevelImageVisual::PlayState::PLAYING )
- {
- if( currentFrame >= endFrame )
- {
- if( loopCount < 0 )
- {
- // repeat forever
- ResetToStart( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait ); // If the current frame is changed in the event thread, don't overwrite it.
- }
- else
- {
- mCurrentLoop++;
- if( mCurrentLoop >= loopCount )
- {
- mPlayState = DevelImageVisual::PlayState::STOPPED;
-
- ResetToStart( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait );
-
- // Animation is finished
- mAnimationFinishedTrigger->Trigger();
-
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished\n" );
- }
- else
- {
- ResetToStart( mCurrentFrameUpdated, mCurrentFrame, startFrame, mConditionalWait );
- }
- }
- }
- }
-
- if( !resourceReady )
- {
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Resource ready trigger\n" );
-
- mResourceReadyTrigger->Trigger();
- }
-
- auto timeToSleepUntil = currentFrameStartTime + std::chrono::nanoseconds( mFrameDurationNanoSeconds );
-
-#if defined(DEBUG_ENABLED)
- auto sleepDuration = std::chrono::duration_cast< std::chrono::milliseconds >( timeToSleepUntil - std::chrono::system_clock::now() );
-
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: [current = %d, sleep duration = %lld]\n", currentFrame, sleepDuration.count() );
-#endif
-
- std::this_thread::sleep_until( timeToSleepUntil );