lottie/model: refactored path direction handling. 59/184559/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Thu, 19 Jul 2018 01:06:05 +0000 (10:06 +0900)
committersubhransu mohanty <sub.mohanty@samsung.com>
Thu, 19 Jul 2018 01:06:05 +0000 (10:06 +0900)
Change-Id: I6a41f72e3635f3ad91f188d99868b3e8e44d3174

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

index c4129ca131a538b8c13a98973771af4ddbd21e07..54fe48764dc1ad9724d9e72bd3f9b44ad7630475 100644 (file)
@@ -655,15 +655,6 @@ void LOTShapeLayerItem::renderList(std::vector<VDrawable *> &list)
     mRoot->renderList(list);
 }
 
-VPath::Direction LOTContentItem::direction(bool isCW)
-{
-   if (isCW)
-      return VPath::Direction::CW;
-   else
-      return VPath::Direction::CCW;
-}
-
-
 LOTContentGroupItem::LOTContentGroupItem(LOTShapeGroupData *data):mData(data)
 {
    addChildren(mData);
@@ -813,7 +804,7 @@ VPath LOTRectItem::getPath(int frameNo)
    VRectF r(pos.x() - size.x()/2, pos.y() - size.y()/2, size.x(), size.y());
 
    VPath path;
-   path.addRoundRect(r, radius, radius, direction(mData->isDirectionCW()));
+   path.addRoundRect(r, radius, radius, mData->direction());
 
    return path;
 }
@@ -830,7 +821,7 @@ VPath LOTEllipseItem::getPath(int frameNo)
    VRectF r(pos.x() - size.x()/2, pos.y() - size.y()/2, size.x(), size.y());
 
    VPath path;
-   path.addOval(r, direction(mData->isDirectionCW()));
+   path.addOval(r, mData->direction());
 
    return path;
 }
@@ -884,11 +875,11 @@ VPath LOTPolystarItem::getPath(int frameNo)
         path.addPolystarStar(0.0, 0.0, 0.0, points,
                              innerRadius, outerRadius,
                              innerRoundness, outerRoundness,
-                             direction(mData->isDirectionCW()));
+                             mData->direction());
    } else {
         path.addPolystarPolygon(0.0, 0.0, 0.0, points,
                                 outerRadius, outerRoundness,
-                                direction(mData->isDirectionCW()));
+                                mData->direction());
    }
 
    m.translate(pos.x(), pos.y()).rotate(rotation);
index 58f302d20093e2b6a02b4609faca56bc2043dd25..88d0b255af2ac36c8cf24099eae272025221f634 100644 (file)
@@ -215,7 +215,6 @@ public:
    virtual ~LOTContentItem(){}
    virtual void update(int frameNo, const VMatrix &parentMatrix, float parentAlpha, const DirtyFlag &flag) = 0;
    virtual void renderList(std::vector<VDrawable *> &list){}
-   VPath::Direction direction(bool isCW);
 };
 
 class LOTContentGroupItem: public LOTContentItem
index e6c5d9d27533d982215c347debd9ba479c2809b1..fc3475e98172f571929dcea674e2e1fbcd0666fa 100644 (file)
@@ -608,8 +608,9 @@ public:
 class LOTPath : public LOTData
 {
 public:
-    LOTPath(LOTData::Type  type):LOTData(type), mDirection(3){}
-    bool isDirectionCW() const { return ((mDirection == 3) ? false : true );}
+    LOTPath(LOTData::Type  type):LOTData(type), mDirection(1){}
+    VPath::Direction direction() { if (mDirection == 3) return VPath::Direction::CCW;
+                                   else return VPath::Direction::CW;}
 public:
     int                                    mDirection;
     std::vector<std::shared_ptr<LOTData>>  mPathOperations;