lottieplayer: fix broken animation. 88/186788/1
authorHermet Park <hermetpark@gmail.com>
Tue, 14 Aug 2018 09:57:00 +0000 (18:57 +0900)
committerHermet Park <hermetpark@gmail.com>
Tue, 14 Aug 2018 09:57:00 +0000 (18:57 +0900)
A patch occured regression bug, because its depeneded patch was rebased.
call setPos() properly even in deferred method.

Change-Id: I89fa849304b6e5d260cc88c3863d8879c7bb463b

src/lottie/lottieplayer.cpp

index 1b23fd8..d20e4e6 100644 (file)
@@ -9,8 +9,8 @@
 class LOTPlayerPrivate {
 
 private:
-    bool                          setPos(float pos);
-    bool                          update(float pos);
+    void                          setPos(float pos);
+    bool                          update();
 
 public:
     LOTPlayerPrivate();
@@ -53,7 +53,9 @@ VSize LOTPlayerPrivate::size() const
 
 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;
         return empty;
     }
@@ -67,7 +69,7 @@ float LOTPlayerPrivate::playTime() const
     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 < 0) pos = 0;
@@ -75,8 +77,6 @@ bool LOTPlayerPrivate::setPos(float pos)
     if (!vCompare(pos, mPos)) mChanged = true;
 
     mPos = pos;
-
-    return true;
 }
 
 float LOTPlayerPrivate::pos()
@@ -84,13 +84,12 @@ float LOTPlayerPrivate::pos()
     return mPos;
 }
 
-bool LOTPlayerPrivate::update(float pos)
+bool LOTPlayerPrivate::update()
 {
    //Nothing updated, skip it.
    if (!mChanged) return true;
 
    mCompItem->resize(mSize);
-   this->setPos(pos);
 
    int frameNumber;
    if (mModel->isStatic()) frameNumber = 0;
@@ -113,7 +112,9 @@ bool LOTPlayerPrivate::render(float pos, const LOTBuffer &buffer)
 
     bool result = false;
 
-    if (this->update(pos)) {
+    this->setPos(pos);
+
+    if (this->update()) {
 
          mRenderInProgress.store(true);