lottie/vector: added new addroundrect api with uniform roundness of corner.

Change-Id: Id6584d3b4fc4b81f2407ba66cafca4b6521d7fd8
This commit is contained in:
subhransu mohanty 2018-11-01 10:57:14 +09:00
parent 3edf19165b
commit 5265f844b9
2 changed files with 17 additions and 0 deletions

View File

@ -215,6 +215,14 @@ void VPath::VPathData::addRect(const VRectF &rect, VPath::Direction dir)
}
}
void VPath::VPathData::addRoundRect(const VRectF &rect, float roundness,
VPath::Direction dir)
{
if (2 * roundness > rect.width()) roundness = rect.width()/2.0;
if (2 * roundness > rect.height()) roundness = rect.height()/2.0;
addRoundRect(rect, roundness, roundness, dir);
}
void VPath::VPathData::addRoundRect(const VRectF &rect, float rx, float ry,
VPath::Direction dir)
{

View File

@ -33,6 +33,8 @@ public:
void addOval(const VRectF &rect, VPath::Direction dir = Direction::CW);
void addRoundRect(const VRectF &rect, float rx, float ry,
VPath::Direction dir = Direction::CW);
void addRoundRect(const VRectF &rect, float roundness,
VPath::Direction dir = Direction::CW);
void addRect(const VRectF &rect, VPath::Direction dir = Direction::CW);
void addPolystar(float points, float innerRadius, float outerRadius,
float innerRoundness, float outerRoundness,
@ -62,6 +64,7 @@ private:
void transform(const VMatrix &m);
float length() const;
void addRoundRect(const VRectF &, float, float, VPath::Direction);
void addRoundRect(const VRectF &, float, VPath::Direction);
void addRect(const VRectF &, VPath::Direction);
void arcTo(const VRectF &, float, float, bool);
void addCircle(float, float, float, VPath::Direction);
@ -174,6 +177,12 @@ inline void VPath::addRoundRect(const VRectF &rect, float rx, float ry,
d.write().addRoundRect(rect, rx, ry, dir);
}
inline void VPath::addRoundRect(const VRectF &rect, float roundness,
VPath::Direction dir)
{
d.write().addRoundRect(rect, roundness, dir);
}
inline void VPath::addCircle(float cx, float cy, float radius,
VPath::Direction dir)
{