lottie: fixed miscellaneous things regarding trim operation 11/184711/2
authorJaeun Choi <jaeun12.choi@samsung.com>
Fri, 20 Jul 2018 08:59:34 +0000 (17:59 +0900)
committerJaeun Choi <jaeun12.choi@samsung.com>
Fri, 20 Jul 2018 09:01:59 +0000 (18:01 +0900)
 - check if path operator is there before applying it
 - fixed comment
 - fixed indentation

Change-Id: I2b491423cea3a40e5c28436686b24f92d1e6bcfd

src/lottie/lottieitem.cpp

index 06797d1..d928b74 100644 (file)
@@ -607,7 +607,8 @@ LOTShapeLayerItem::LOTShapeLayerItem(LOTLayerData *layerData):LOTLayerItem(layer
     mRoot = new LOTContentGroupItem(nullptr);
     mRoot->addChildren(layerData);
     mRoot->processPaintOperation();
-    mRoot->processTrimOperation();
+    if (layerData->hasPathOperator())
+      mRoot->processTrimOperation();
 }
 
 LOTShapeLayerItem::~LOTShapeLayerItem()
@@ -781,7 +782,7 @@ void LOTContentGroupItem::trimOperationHelper(std::vector<LOTTrimItem *> &list)
    for (auto i = mContents.rbegin(); i != mContents.rend(); ++i) {
       auto child = *i;
       if (auto pathNode = dynamic_cast<LOTPathDataItem *>(child)) {
-         // the node is a path data node add the paint operation list to it.
+         // the node is a path data node add the trim operation list to it.
          pathNode->addTrimOperation(list);
       } else if (auto trimNode = dynamic_cast<LOTTrimItem *>(child)) {
          // add it to the trim operation list
@@ -797,7 +798,7 @@ void LOTContentGroupItem::trimOperationHelper(std::vector<LOTTrimItem *> &list)
 void LOTPathDataItem::addTrimOperation(std::vector<LOTTrimItem *> &list)
 {
    for(auto trimItem : list) {
-         mTrimNodeRefs.push_back(trimItem);
+      mTrimNodeRefs.push_back(trimItem);
    }
 }