Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: src/core/SkPath.cpp

Issue 863123005: share code between arcTo and addArc, update dox (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPath.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 682c94544c817e8623a1bdb6a87f31ee7f39ea0d..195424e7c0b79c9ba94a7aa1a5b415635f37e30c 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;
« no previous file with comments | « include/core/SkPath.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698