MCPcopy Create free account
hub / github.com/Samsung/rlottie / length

Method length

src/vector/vpath.cpp:41–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41float VPath::VPathData::length() const
42{
43 if (!mLengthDirty) return mLength;
44
45 mLengthDirty = false;
46 mLength = 0.0;
47
48 size_t i = 0;
49 for (auto e : m_elements) {
50 switch (e) {
51 case VPath::Element::MoveTo:
52 i++;
53 break;
54 case VPath::Element::LineTo: {
55 mLength += VLine(m_points[i - 1], m_points[i]).length();
56 i++;
57 break;
58 }
59 case VPath::Element::CubicTo: {
60 mLength += VBezier::fromPoints(m_points[i - 1], m_points[i],
61 m_points[i + 1], m_points[i + 2])
62 .length();
63 i += 3;
64 break;
65 }
66 case VPath::Element::Close:
67 break;
68 }
69 }
70
71 return mLength;
72}
73
74void VPath::VPathData::checkNewSegment()
75{

Callers

nothing calls this directly

Calls 1

VLineFunction · 0.85

Tested by

no test coverage detected