lottie/builder: Fix a broken animation

The animation couldn't be triggered on a single thread.
Regression bug introduced by 29b5bc372d
This commit is contained in:
Hermet Park 2023-11-10 09:35:30 +09:00 committed by Hermet Park
parent 29b5bc372d
commit b133b2a8ae

View file

@ -75,6 +75,7 @@ void LottieLoader::run(unsigned tid)
w = static_cast<float>(comp->w); w = static_cast<float>(comp->w);
h = static_cast<float>(comp->h); h = static_cast<float>(comp->h);
frameDuration = comp->duration(); frameDuration = comp->duration();
frameCnt = comp->frameCnt();
} }
} }
@ -106,10 +107,9 @@ bool LottieLoader::header()
{ {
//A single thread doesn't need to perform intensive tasks. //A single thread doesn't need to perform intensive tasks.
if (TaskScheduler::threads() == 0) { if (TaskScheduler::threads() == 0) {
LottieParser parser(content, dirName); run(0);
if (!parser.parse()) return false; if (comp) return true;
comp = parser.comp; else return false;
return true;
} }
//Quickly validate the given Lottie file without parsing in order to get the animation info. //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); TaskScheduler::request(this);
if (comp && TaskScheduler::threads() == 0) {
frameCnt = comp->frameCnt();
}
return true; return true;
} }