loader/lottie: fix a wrong precomp time remapping.

the remapped frame number should be applied to the only referenced
precomp layer.
This commit is contained in:
Hermet Park 2023-09-07 14:46:10 +09:00 committed by Hermet Park
parent a49ac81543
commit b5fcc90e5d
2 changed files with 3 additions and 3 deletions

View file

@ -694,6 +694,8 @@ static void _updatePrecomp(LottieLayer* precomp, int32_t frameNo)
{
if (precomp->children.count == 0) return;
frameNo -= precomp->startFrame;
//TODO: skip if the layer is static.
for (auto child = precomp->children.end() - 1; child >= precomp->children.data; --child) {
_updateLayer(precomp, static_cast<LottieLayer*>(*child), frameNo);

View file

@ -148,9 +148,7 @@ int32_t LottieLayer::remap(int32_t frameNo)
if (timeRemap.frames) {
frameNo = comp->frameAtTime(timeRemap(frameNo));
}
if (type == Precomp) return (int32_t)(frameNo / timeStretch) - startFrame;
else return (int32_t)(frameNo / timeStretch);
return (int32_t)(frameNo / timeStretch);
}