lottie: fix issue of layer static property updation. 85/184185/2
authorsubhransu mohanty <sub.mohanty@samsung.com>
Mon, 16 Jul 2018 06:48:03 +0000 (15:48 +0900)
committerHermet Park <chuneon.park@samsung.com>
Mon, 16 Jul 2018 12:19:20 +0000 (12:19 +0000)
Layer can have a parent as well as can be part of the precomp layer.
so take both layers static property into consideration while updating the static property.

Change-Id: I59db01a596977896ab1e9c131ee3ff28e694ff0b

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

index 6b4b2a7..62e46c6 100644 (file)
@@ -410,6 +410,7 @@ VRle LOTLayerItem::maskRle()
 
 LOTLayerItem::LOTLayerItem(LOTLayerData *layerData):mLayerData(layerData),
                                                     mParentLayer(nullptr),
+                                                    mPrecompLayer(nullptr),
                                                     mFrameNo(-1),
                                                     mDirtyFlag(DirtyFlagBit::All)
 {
@@ -425,7 +426,9 @@ void LOTLayerItem::updateStaticProperty()
    if (mParentLayer)
      mParentLayer->updateStaticProperty();
 
-   mStatic = mParentLayer ? (mLayerData->isStatic() & mParentLayer->isStatic()) : mLayerData->isStatic();
+   mStatic = mLayerData->isStatic();
+   mStatic = mParentLayer ? (mStatic & mParentLayer->isStatic()) : mStatic;
+   mStatic = mPrecompLayer ? (mStatic & mPrecompLayer->isStatic()) : mStatic;
 }
 
 void LOTLayerItem::update(int frameNo, const VMatrix &parentMatrix, float parentAlpha)
@@ -519,10 +522,17 @@ LOTCompLayerItem::LOTCompLayerItem(LOTLayerData *layerModel):LOTLayerItem(layerM
            i->setParentLayer(parentLayer);
          }
       }
+      i->setPrecompLayer(this);
    }
-   for(auto i : mLayers) {
+}
+
+void LOTCompLayerItem::updateStaticProperty()
+{
+    LOTLayerItem::updateStaticProperty();
+
+    for(auto i : mLayers) {
        i->updateStaticProperty();
-   }
+    }
 }
 
 LOTCompLayerItem::~LOTCompLayerItem()
index d6e9261..6fd6f32 100644 (file)
@@ -59,10 +59,11 @@ public:
    int id() const {return mLayerData->id();}
    int parentId() const {return mLayerData->parentId();}
    void setParentLayer(LOTLayerItem *parent){mParentLayer = parent;}
+   void setPrecompLayer(LOTLayerItem *precomp){mPrecompLayer = precomp;}
    virtual void update(int frameNo, const VMatrix &parentMatrix, float parentAlpha);
    VMatrix matrix(int frameNo) const;
    virtual void renderList(std::vector<VDrawable *> &list){}
-   void updateStaticProperty();
+   virtual void updateStaticProperty();
    void render(VPainter *painter);
 protected:
    virtual void updateContent() = 0;
@@ -79,6 +80,7 @@ protected:
    std::vector<std::unique_ptr<LOTMaskItem>>   mMasks;
    LOTLayerData                               *mLayerData;
    LOTLayerItem                               *mParentLayer;
+   LOTLayerItem                               *mPrecompLayer;
    VMatrix                                    mCombinedMatrix;
    float                                       mCombinedAlpha;
    int                                         mFrameNo;
@@ -93,6 +95,7 @@ public:
    ~LOTCompLayerItem();
    LOTCompLayerItem(LOTLayerData *layerData);
    void renderList(std::vector<VDrawable *> &list)final;
+   void updateStaticProperty() final;
 protected:
    void updateContent() final;
 private: