lottie: code clean up

This commit is contained in:
Hermet Park 2024-04-16 20:55:53 +09:00
parent 9fd34c8503
commit a6eddcbfab

View file

@ -352,8 +352,7 @@ float LottieLoader::duration()
if (!comp) done(); if (!comp) done();
if (!comp) return 0.0f; if (!comp) return 0.0f;
auto frameNo = frameCnt * (segmentEnd - segmentBegin); return frameCnt * (segmentEnd - segmentBegin) / comp->frameRate;
return frameNo / comp->frameRate;
} }
@ -374,7 +373,7 @@ uint32_t LottieLoader::markersCnt()
const char* LottieLoader::markers(uint32_t index) const char* LottieLoader::markers(uint32_t index)
{ {
if (!comp) done(); if (!comp) done();
if (!comp || index < 0 || index >= markersCnt()) return nullptr; if (!comp || index >= comp->markers.count) return nullptr;
auto marker = comp->markers.begin() + index; auto marker = comp->markers.begin() + index;
return (*marker)->name; return (*marker)->name;
} }