lottie/vector: refactor VDasher.
[platform/core/uifw/lottie-player.git] / src / vector / vdasher.h
1 #ifndef VDASHER_H
2 #define VDASHER_H
3 #include "vpath.h"
4
5 V_BEGIN_NAMESPACE
6
7 class VDasher {
8 public:
9     VDasher(const float *dashArray, int size);
10     VPath dashed(const VPath &path);
11
12 private:
13     void moveTo(const VPointF &p);
14     void lineTo(const VPointF &p);
15     void cubicTo(const VPointF &cp1, const VPointF &cp2, const VPointF &e);
16     void close();
17     void addLine(const VPointF &p);
18     void addCubic(const VPointF &cp1, const VPointF &cp2, const VPointF &e);
19     void updateActiveSegment();
20
21 private:
22     struct Dash {
23         float length;
24         float gap;
25     };
26     const VDasher::Dash *mDashArray;
27     int                  mArraySize;
28     VPointF              mCurPt;
29     int                  mIndex; /* index to the dash Array */
30     float                mCurrentLength;
31     bool                 mDiscard;
32     float                mDashOffset;
33     VPath                mResult;
34     bool                 mStartNewSegment=true;
35 };
36
37 V_END_NAMESPACE
38
39 #endif  // VDASHER_H