lottie: fix issue - path was not updated properly for each painter item 57/187557/1
authorYoungbok Shin <youngb.shin@samsung.com>
Fri, 24 Aug 2018 05:41:31 +0000 (14:41 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Fri, 24 Aug 2018 05:44:03 +0000 (14:44 +0900)
It also adds debug message for polystar type.

Change-Id: Ie1b788571d003402da0d518be484a0458df5dcec

src/lottie/lottieitem.cpp
src/lottie/lottieitem.h
src/lottie/lottieparser.cpp

index 8d57009..35be998 100644 (file)
@@ -641,16 +641,15 @@ void LOTPathDataItem::update(int frameNo, const VMatrix &parentMatrix,
     mPathChanged = false;
 
     // 1. update the local path if needed
-    if (!(mInit && mStaticPath) && hasChanged(frameNo)) {
+    if (hasChanged(frameNo)) {
         updatePath(mLocalPath, frameNo);
-        mInit = true;
         mPathChanged = true;
+        mNeedUpdate = true;
     }
 
     mTemp = mLocalPath;
 
     // 3. compute the final path with parentMatrix
-
     if ((flag & DirtyFlagBit::Matrix) || mPathChanged) {
         mMatrix = parentMatrix;
         mPathChanged = true;
@@ -659,10 +658,10 @@ void LOTPathDataItem::update(int frameNo, const VMatrix &parentMatrix,
 
 const VPath & LOTPathDataItem::finalPath()
 {
-    if (mPathChanged) {
+    if (mPathChanged || mNeedUpdate) {
         mFinalPath.clone(mTemp);
         mFinalPath.transform(mMatrix);
-        mPathChanged = false;
+        mNeedUpdate = false;
     }
     return mFinalPath;
 }
index 1ef0ee3..b2d8a8f 100644 (file)
@@ -193,20 +193,21 @@ private:
 class LOTPathDataItem : public LOTContentItem
 {
 public:
-   LOTPathDataItem(bool staticPath):mInit(false), mStaticPath(staticPath){}
+   LOTPathDataItem(bool staticPath): mStaticPath(staticPath){}
    void update(int frameNo, const VMatrix &parentMatrix, float parentAlpha, const DirtyFlag &flag) final;
    bool dirty() const {return mPathChanged;}
    const VPath &localPath() const {return mTemp;}
    const VPath &finalPath();
-   void updatePath(const VPath &path) {mTemp.clone(path); mPathChanged = true;}
+   void updatePath(const VPath &path) {mTemp.clone(path); mPathChanged = true; mNeedUpdate = true;}
+   bool staticPath() const { return mStaticPath; }
 private:
-   bool                                    mInit;
    bool                                    mStaticPath;
    VPath                                   mLocalPath;
    VPath                                   mTemp;
    VPath                                   mFinalPath;
    VMatrix                                 mMatrix;
    bool                                    mPathChanged{true};
+   bool                                    mNeedUpdate{true};
 protected:
    virtual void updatePath(VPath& path, int frameNo) = 0;
    virtual bool hasChanged(int frameNo) = 0;
@@ -235,6 +236,7 @@ protected:
         mCache.mRoundness = roundness;
    }
    bool hasChanged(int frameNo) final {
+        if (mCache.mFrameNo != -1 && staticPath()) return false;
         if (mCache.mFrameNo == frameNo) return false;
 
         VPointF pos = mData->mPos.value(frameNo);
@@ -271,6 +273,7 @@ private:
         mCache.mSize = size;
    }
    bool hasChanged(int frameNo) final {
+        if (mCache.mFrameNo != -1 && staticPath()) return false;
         if (mCache.mFrameNo == frameNo) return false;
 
         VPointF pos = mData->mPos.value(frameNo);
@@ -326,6 +329,7 @@ private:
         mCache.mRotation = rotation;
    }
    bool hasChanged(int frameNo) final {
+        if (mCache.mFrameNo != -1 && staticPath()) return false;
         if (mCache.mFrameNo == frameNo) return false;
 
         VPointF pos = mData->mPos.value(frameNo);
index beadb66..be8dbc9 100644 (file)
@@ -1891,6 +1891,10 @@ public:
     {
         vDebug << "[ELLIPSE: static:" << e->isStatic() << "]";
     }
+    void visit(LOTPolystarData *e)
+    {
+        vDebug << "[POLYSTAR: static:" << e->isStatic() << "]";
+    }
     void visit(LOTTrimData *t)
     {
         vDebug << "[TRIM: static: " << t->isStatic() << " ]";