5e93f8ff1503d5aabb1f0a54ed37077d0f64491a
[platform/core/uifw/lottie-player.git] / src / vector / vpathmesure.cpp
1 #include "vpathmesure.h"
2 #include "vbezier.h"
3 #include "vdasher.h"
4
5 V_BEGIN_NAMESPACE
6
7 void VPathMesure::setOffset(float sp, float ep)
8 {
9     startOffset = sp;
10     endOffset = ep;
11 }
12
13 VPath VPathMesure::trim(const VPath &path)
14 {
15     if (vCompare(startOffset, 0.0f) && (vCompare(endOffset, 1.0f))) return path;
16
17     float len = path.length();
18     float sg = len * startOffset;
19     float eg = len * (1.0f - endOffset);
20     len = len - (sg + eg);
21
22     float   array[5] = {0.0f, sg, len, 1000, 0.0f};
23     VDasher dasher(array, 5);
24
25     return dasher.dashed(path);
26 }
27
28 V_END_NAMESPACE