aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-01-29 12:59:11 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-29 12:59:11 -0800
commitc778904a5b686617ad7fdec850ddc21e103dca0f (patch)
tree5db306b1f9a2a23e6afd2ab748cfe85ddc0b5205 /src
parentf9a40723f5d9bfe02cc60bedb5b956916e5cea01 (diff)
share code between arcTo and addArc, update dox
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPath.cpp31
1 files changed, 3 insertions, 28 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 682c94544c..195424e7c0 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1340,41 +1340,16 @@ void SkPath::addArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle
if (sweepAngle >= kFullCircleAngle || sweepAngle <= -kFullCircleAngle) {
this->addOval(oval, sweepAngle > 0 ? kCW_Direction : kCCW_Direction);
- return;
- }
-
- SkPoint lonePt;
- if (arc_is_lone_point(oval, startAngle, sweepAngle, &lonePt)) {
- this->moveTo(lonePt);
- return;
- }
-
- SkPoint pts[kSkBuildQuadArcStorage];
- int count = build_arc_points(oval, startAngle, sweepAngle, pts);
-
- SkDEBUGCODE(this->validate();)
- SkASSERT(count & 1);
-
- fLastMoveToIndex = fPathRef->countPoints();
-
- SkPathRef::Editor ed(&fPathRef, 1+(count-1)/2, count);
-
- ed.growForVerb(kMove_Verb)->set(pts[0].fX, pts[0].fY);
- if (count > 1) {
- SkPoint* p = ed.growForRepeatedVerb(kQuad_Verb, (count-1)/2);
- memcpy(p, &pts[1], (count-1) * sizeof(SkPoint));
+ } else {
+ this->arcTo(oval, startAngle, sweepAngle, true);
}
-
- DIRTY_AFTER_EDIT;
- SkDEBUGCODE(this->validate();)
}
/*
Need to handle the case when the angle is sharp, and our computed end-points
for the arc go behind pt1 and/or p2...
*/
-void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
- SkScalar radius) {
+void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius) {
if (radius == 0) {
this->lineTo(x1, y1);
return;