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; }