From b133b2a8ae4f0735aa741285c7bd3c1f5d6e6919 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 10 Nov 2023 09:35:30 +0900 Subject: [PATCH] lottie/builder: Fix a broken animation The animation couldn't be triggered on a single thread. Regression bug introduced by 29b5bc372de91cc9ef62b02d6c3117a4e24a7ff0 --- src/loaders/lottie/tvgLottieLoader.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/loaders/lottie/tvgLottieLoader.cpp b/src/loaders/lottie/tvgLottieLoader.cpp index 60c5f7ef..eec43a6a 100644 --- a/src/loaders/lottie/tvgLottieLoader.cpp +++ b/src/loaders/lottie/tvgLottieLoader.cpp @@ -75,6 +75,7 @@ void LottieLoader::run(unsigned tid) w = static_cast(comp->w); h = static_cast(comp->h); frameDuration = comp->duration(); + frameCnt = comp->frameCnt(); } } @@ -106,10 +107,9 @@ bool LottieLoader::header() { //A single thread doesn't need to perform intensive tasks. if (TaskScheduler::threads() == 0) { - LottieParser parser(content, dirName); - if (!parser.parse()) return false; - comp = parser.comp; - return true; + run(0); + if (comp) return true; + else return false; } //Quickly validate the given Lottie file without parsing in order to get the animation info. @@ -298,10 +298,6 @@ bool LottieLoader::read() TaskScheduler::request(this); - if (comp && TaskScheduler::threads() == 0) { - frameCnt = comp->frameCnt(); - } - return true; }