lottie/vector: update reserve() api in vpath

Change-Id: Ib43afa96a0c1a7764dd410ea1e7f01019f592d6d
This commit is contained in:
subhransu mohanty 2018-07-26 11:11:28 +09:00
parent f35ca73d48
commit f6658ae623
2 changed files with 7 additions and 7 deletions

View File

@ -83,10 +83,10 @@ int VPath::VPathData::segments() const
return m_segments + 1; return m_segments + 1;
} }
void VPath::VPathData::reserve(int num_elm) void VPath::VPathData::reserve(int pts, int elms)
{ {
m_elements.reserve(num_elm); m_points.reserve(m_points.size() + pts);
m_points.reserve(2 * num_elm); m_elements.reserve(m_elements.size() + elms);
} }
static VPointF curvesForArc(const VRectF &, float, float, VPointF *, int *); static VPointF curvesForArc(const VRectF &, float, float, VPointF *, int *);

View File

@ -33,7 +33,7 @@ public:
void arcTo(const VRectF &rect, float startAngle, float sweepLength, bool forceMoveTo); void arcTo(const VRectF &rect, float startAngle, float sweepLength, bool forceMoveTo);
void close(); void close();
void reset(); void reset();
void reserve(int num_elm); void reserve(int pts, int elms);
int segments() const; int segments() const;
void addCircle(float cx, float cy, float radius, VPath::Direction dir = Direction::CW); void addCircle(float cx, float cy, float radius, VPath::Direction dir = Direction::CW);
void addOval(const VRectF &rect, VPath::Direction dir = Direction::CW); void addOval(const VRectF &rect, VPath::Direction dir = Direction::CW);
@ -57,7 +57,7 @@ private:
void cubicTo(const VPointF &c1, const VPointF &c2, const VPointF &e); void cubicTo(const VPointF &c1, const VPointF &c2, const VPointF &e);
void close(); void close();
void reset(); void reset();
void reserve(int num_elm); void reserve(int, int);
void checkNewSegment(); void checkNewSegment();
int segments() const; int segments() const;
void transform(const VMatrix &m); void transform(const VMatrix &m);
@ -108,9 +108,9 @@ inline void VPath::reset()
d.write().reset(); d.write().reset();
} }
inline void VPath::reserve(int num_elm) inline void VPath::reserve(int pts, int elms)
{ {
d.write().reserve(num_elm); d.write().reserve(pts, elms);
} }
inline int VPath::segments() const inline int VPath::segments() const