mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-27 08:36:59 +00:00
lottie loader: implement the necessary interaces.
This commit is contained in:
parent
73a8792eae
commit
193a9833a8
1 changed files with 12 additions and 4 deletions
|
@ -65,8 +65,8 @@ static int _str2float(const char* str, int len)
|
||||||
|
|
||||||
void LottieLoader::clear()
|
void LottieLoader::clear()
|
||||||
{
|
{
|
||||||
//TODO: Clear all used resources
|
|
||||||
if (copy) free((char*)content);
|
if (copy) free((char*)content);
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
content = nullptr;
|
content = nullptr;
|
||||||
copy = false;
|
copy = false;
|
||||||
|
@ -279,9 +279,15 @@ unique_ptr<Paint> LottieLoader::paint()
|
||||||
|
|
||||||
bool LottieLoader::frame(uint32_t frameNo)
|
bool LottieLoader::frame(uint32_t frameNo)
|
||||||
{
|
{
|
||||||
|
if (this->frameNo == frameNo) return true;
|
||||||
|
|
||||||
this->done();
|
this->done();
|
||||||
|
|
||||||
return true;
|
if (!comp || frameNo >= comp->frameCnt()) return false;
|
||||||
|
|
||||||
|
this->frameNo = frameNo;
|
||||||
|
|
||||||
|
return builder->update(comp, frameNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -289,7 +295,8 @@ uint32_t LottieLoader::totalFrame()
|
||||||
{
|
{
|
||||||
this->done();
|
this->done();
|
||||||
|
|
||||||
return 0;
|
if (!comp) return 0;
|
||||||
|
return comp->frameCnt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -305,5 +312,6 @@ float LottieLoader::duration()
|
||||||
{
|
{
|
||||||
this->done();
|
this->done();
|
||||||
|
|
||||||
return 0;
|
if (!comp) return 0;
|
||||||
|
return comp->duration();
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue