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

Unified Diff: src/core/SkPath.cpp

Issue 785933003: change SkPoint::setLength to set itself to (0,0) if it starting length is degenerate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkPoint.h ('k') | src/core/SkPoint.cpp » ('j') | 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 a08abbd14b6bda1e1d8716b6f78652b465d44e98..2cb33e20127879c7ab65354e19ba59fc4cd0fca2 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1287,7 +1287,12 @@ void SkPath::addArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle
*/
void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
SkScalar radius) {
- SkVector before, after;
+ if (radius == 0) {
+ this->lineTo(x1, y1);
+ return;
+ }
+
+ SkVector before, after;
// need to know our prev pt so we can construct tangent vectors
{
@@ -1295,12 +1300,6 @@ void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
this->getLastPt(&start);
// Handle degenerate cases by adding a line to the first point and
// bailing out.
- if ((x1 == start.fX && y1 == start.fY) ||
- (x1 == x2 && y1 == y2) ||
- radius == 0) {
- this->lineTo(x1, y1);
- return;
- }
before.setNormalize(x1 - start.fX, y1 - start.fY);
after.setNormalize(x2 - x1, y2 - y1);
}
« no previous file with comments | « include/core/SkPoint.h ('k') | src/core/SkPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698