lottie: move cnodelist to capidata to reduce layer object size
authorsub.mohanty@samsung.com <smohantty@gmail.com>
Sun, 25 Aug 2019 01:27:51 +0000 (10:27 +0900)
committerHermet Park <hermetpark@gmail.com>
Wed, 4 Sep 2019 08:28:25 +0000 (17:28 +0900)
Change-Id: Ie8321d759ae0c859a89cd0e3c27380300f65c56f

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

index 7e7cd97..538f586 100644 (file)
@@ -766,14 +766,14 @@ void LOTSolidLayerItem::buildLayerNode()
     mDrawableList.clear();
     renderList(mDrawableList);
 
-    mCNodeList.clear();
+    cnodes().clear();
     for (auto &i : mDrawableList) {
         auto lotDrawable = static_cast<LOTDrawable *>(i);
         lotDrawable->sync();
-        mCNodeList.push_back(lotDrawable->mCNode.get());
+        cnodes().push_back(lotDrawable->mCNode.get());
     }
-    clayer().mNodeList.ptr = mCNodeList.data();
-    clayer().mNodeList.size = mCNodeList.size();
+    clayer().mNodeList.ptr = cnodes().data();
+    clayer().mNodeList.size = cnodes().size();
 }
 
 void LOTSolidLayerItem::renderList(std::vector<VDrawable *> &list)
@@ -825,7 +825,7 @@ void LOTImageLayerItem::buildLayerNode()
     mDrawableList.clear();
     renderList(mDrawableList);
 
-    mCNodeList.clear();
+    cnodes().clear();
     for (auto &i : mDrawableList) {
         auto lotDrawable = static_cast<LOTDrawable *>(i);
         lotDrawable->sync();
@@ -849,10 +849,10 @@ void LOTImageLayerItem::buildLayerNode()
         lotDrawable->mCNode->mImageInfo.mMatrix.m32 = combinedMatrix().m_ty();
         lotDrawable->mCNode->mImageInfo.mMatrix.m33 = combinedMatrix().m_33();
 
-        mCNodeList.push_back(lotDrawable->mCNode.get());
+        cnodes().push_back(lotDrawable->mCNode.get());
     }
-    clayer().mNodeList.ptr = mCNodeList.data();
-    clayer().mNodeList.size = mCNodeList.size();
+    clayer().mNodeList.ptr = cnodes().data();
+    clayer().mNodeList.size = cnodes().size();
 }
 
 LOTNullLayerItem::LOTNullLayerItem(LOTLayerData *layerData)
@@ -946,14 +946,14 @@ void LOTShapeLayerItem::buildLayerNode()
     mDrawableList.clear();
     renderList(mDrawableList);
 
-    mCNodeList.clear();
+    cnodes().clear();
     for (auto &i : mDrawableList) {
         auto lotDrawable = static_cast<LOTDrawable *>(i);
         lotDrawable->sync();
-        mCNodeList.push_back(lotDrawable->mCNode.get());
+        cnodes().push_back(lotDrawable->mCNode.get());
     }
-    clayer().mNodeList.ptr = mCNodeList.data();
-    clayer().mNodeList.size = mCNodeList.size();
+    clayer().mNodeList.ptr = cnodes().data();
+    clayer().mNodeList.size = cnodes().size();
 }
 
 void LOTShapeLayerItem::renderList(std::vector<VDrawable *> &list)
index f17aa6c..22bdf35 100644 (file)
@@ -104,6 +104,7 @@ struct LOTCApiData
     LOTLayerNode                  mLayer;
     std::vector<LOTMask>          mMasks;
     std::vector<LOTLayerNode *>   mLayers;
+    std::vector<LOTNode *>        mCNodeList;
 };
 
 class LOTLayerItem
@@ -128,6 +129,7 @@ public:
    LOTLayerNode& clayer() {return mCApiData->mLayer;}
    std::vector<LOTLayerNode *>& clayers() {return mCApiData->mLayers;}
    std::vector<LOTMask>& cmasks() {return mCApiData->mMasks;}
+   std::vector<LOTNode *>& cnodes() {return mCApiData->mCNodeList;}
    const char* name() const {return mLayerData->name();}
    virtual bool resolveKeyPath(LOTKeyPath &keyPath, uint depth, LOTVariant &value);
    VBitmap& bitmap() {return mRenderBuffer;}
@@ -181,7 +183,6 @@ protected:
    void updateContent() final;
    void renderList(std::vector<VDrawable *> &list) final;
 private:
-   std::vector<LOTNode *>       mCNodeList;
    LOTDrawable                  mRenderNode;
 };
 
@@ -197,7 +198,6 @@ public:
    bool resolveKeyPath(LOTKeyPath &keyPath, uint depth, LOTVariant &value) override;
 protected:
    void updateContent() final;
-   std::vector<LOTNode *>               mCNodeList;
    std::unique_ptr<LOTContentGroupItem> mRoot;
 };
 
@@ -218,7 +218,6 @@ protected:
    void updateContent() final;
    void renderList(std::vector<VDrawable *> &list) final;
 private:
-   std::vector<LOTNode *>       mCNodeList;
    LOTDrawable                  mRenderNode;
 };