X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-vector-image%2Fvector-animation-thread.cpp;h=c6dbdb6bf9d2c85bcca3b6177a3d86c5268a63d0;hp=a5b11662831ad4e6f969c9a5838573d7aed437a5;hb=b6e5096fe564c1fb6c56383b1e878eb51358ae41;hpb=b8da2e53925b9abb9fa362560069e8ca4aa62f81 diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp index a5b1166..c6dbdb6 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,9 @@ void VectorAnimationThread::AddTask(VectorAnimationTaskPtr task) { ConditionalWait::ScopedLock lock(mConditionalWait); - if(mAnimationTasks.end() == std::find(mAnimationTasks.begin(), mAnimationTasks.end(), task)) + // Find if the task is already in the list except loading task + auto iter = std::find_if(mAnimationTasks.begin(), mAnimationTasks.end(), [task](VectorAnimationTaskPtr& element) { return (element == task && !element->IsLoadRequested()); }); + if(iter == mAnimationTasks.end()) { auto currentTime = task->CalculateNextFrameTime(true); // Rasterize as soon as possible @@ -112,7 +114,7 @@ void VectorAnimationThread::AddTask(VectorAnimationTaskPtr task) } } -void VectorAnimationThread::OnTaskCompleted(VectorAnimationTaskPtr task, bool keepAnimation) +void VectorAnimationThread::OnTaskCompleted(VectorAnimationTaskPtr task, bool success, bool keepAnimation) { if(!mDestroyThread) { @@ -131,7 +133,7 @@ void VectorAnimationThread::OnTaskCompleted(VectorAnimationTaskPtr task, bool ke needRasterize = true; } - if(keepAnimation) + if(keepAnimation && success) { if(mCompletedTasks.end() == std::find(mCompletedTasks.begin(), mCompletedTasks.end(), task)) { @@ -216,13 +218,13 @@ void VectorAnimationThread::Rasterize() { VectorAnimationTaskPtr nextTask = *it; - auto currentTime = std::chrono::system_clock::now(); + auto currentTime = std::chrono::steady_clock::now(); auto nextFrameTime = nextTask->GetNextFrameTime(); #if defined(DEBUG_ENABLED) - auto duration = std::chrono::duration_cast(nextFrameTime - currentTime); +// auto duration = std::chrono::duration_cast(nextFrameTime - currentTime); - DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationThread::Rasterize: [next time = %lld]\n", duration.count()); +// DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationThread::Rasterize: [next time = %lld]\n", duration.count()); #endif if(nextFrameTime <= currentTime) @@ -300,7 +302,7 @@ VectorAnimationThread::SleepThread::~SleepThread() Join(); } -void VectorAnimationThread::SleepThread::SleepUntil(std::chrono::time_point timeToSleepUntil) +void VectorAnimationThread::SleepThread::SleepUntil(std::chrono::time_point timeToSleepUntil) { ConditionalWait::ScopedLock lock(mConditionalWait); mSleepTimePoint = timeToSleepUntil; @@ -316,7 +318,7 @@ void VectorAnimationThread::SleepThread::Run() while(!mDestroyThread) { bool needToSleep; - std::chrono::time_point sleepTimePoint; + std::chrono::time_point sleepTimePoint; { ConditionalWait::ScopedLock lock(mConditionalWait); @@ -330,9 +332,9 @@ void VectorAnimationThread::SleepThread::Run() if(needToSleep) { #if defined(DEBUG_ENABLED) - auto sleepDuration = std::chrono::duration_cast(mSleepTimePoint - std::chrono::system_clock::now()); +// auto sleepDuration = std::chrono::duration_cast(mSleepTimePoint - std::chrono::steady_clock::now()); - DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationThread::SleepThread::Run: [sleep duration = %lld]\n", sleepDuration.count()); +// DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "VectorAnimationThread::SleepThread::Run: [sleep duration = %lld]\n", sleepDuration.count()); #endif std::this_thread::sleep_until(sleepTimePoint);