mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-08 15:23:12 +00:00
lottieplayer: fix broken animation.
A patch occured regression bug, because its depeneded patch was rebased. call setPos() properly even in deferred method. Change-Id: I89fa849304b6e5d260cc88c3863d8879c7bb463b
This commit is contained in:
parent
49d374788d
commit
e6b7dd8551
@ -9,8 +9,8 @@
|
|||||||
class LOTPlayerPrivate {
|
class LOTPlayerPrivate {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool setPos(float pos);
|
void setPos(float pos);
|
||||||
bool update(float pos);
|
bool update();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LOTPlayerPrivate();
|
LOTPlayerPrivate();
|
||||||
@ -53,7 +53,9 @@ VSize LOTPlayerPrivate::size() const
|
|||||||
|
|
||||||
const std::vector<LOTNode *> &LOTPlayerPrivate::renderList(float pos)
|
const std::vector<LOTNode *> &LOTPlayerPrivate::renderList(float pos)
|
||||||
{
|
{
|
||||||
if (!mCompItem || !this->update(pos)) {
|
this->setPos(pos);
|
||||||
|
|
||||||
|
if (!mCompItem || !this->update()) {
|
||||||
static std::vector<LOTNode *> empty;
|
static std::vector<LOTNode *> empty;
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
@ -67,7 +69,7 @@ float LOTPlayerPrivate::playTime() const
|
|||||||
return float(mModel->frameDuration()) / float(mModel->frameRate());
|
return float(mModel->frameDuration()) / float(mModel->frameRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LOTPlayerPrivate::setPos(float pos)
|
void LOTPlayerPrivate::setPos(float pos)
|
||||||
{
|
{
|
||||||
if (pos > 1.0) pos = 1.0;
|
if (pos > 1.0) pos = 1.0;
|
||||||
if (pos < 0) pos = 0;
|
if (pos < 0) pos = 0;
|
||||||
@ -75,8 +77,6 @@ bool LOTPlayerPrivate::setPos(float pos)
|
|||||||
if (!vCompare(pos, mPos)) mChanged = true;
|
if (!vCompare(pos, mPos)) mChanged = true;
|
||||||
|
|
||||||
mPos = pos;
|
mPos = pos;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float LOTPlayerPrivate::pos()
|
float LOTPlayerPrivate::pos()
|
||||||
@ -84,13 +84,12 @@ float LOTPlayerPrivate::pos()
|
|||||||
return mPos;
|
return mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LOTPlayerPrivate::update(float pos)
|
bool LOTPlayerPrivate::update()
|
||||||
{
|
{
|
||||||
//Nothing updated, skip it.
|
//Nothing updated, skip it.
|
||||||
if (!mChanged) return true;
|
if (!mChanged) return true;
|
||||||
|
|
||||||
mCompItem->resize(mSize);
|
mCompItem->resize(mSize);
|
||||||
this->setPos(pos);
|
|
||||||
|
|
||||||
int frameNumber;
|
int frameNumber;
|
||||||
if (mModel->isStatic()) frameNumber = 0;
|
if (mModel->isStatic()) frameNumber = 0;
|
||||||
@ -113,7 +112,9 @@ bool LOTPlayerPrivate::render(float pos, const LOTBuffer &buffer)
|
|||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (this->update(pos)) {
|
this->setPos(pos);
|
||||||
|
|
||||||
|
if (this->update()) {
|
||||||
|
|
||||||
mRenderInProgress.store(true);
|
mRenderInProgress.store(true);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user