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

Unified Diff: src/core/SkPoint.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 | « src/core/SkPath.cpp ('k') | tests/PointTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPoint.cpp
diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp
index 2970e35c54336a9f5f4aa7e6f31b334f1ba1aae4..20bc33666eb053ff8428af8d920d3f4ffb499596 100644
--- a/src/core/SkPoint.cpp
+++ b/src/core/SkPoint.cpp
@@ -100,6 +100,7 @@ SkScalar SkPoint::Normalize(SkPoint* pt) {
float y = pt->fY;
float mag2;
if (isLengthNearlyZero(x, y, &mag2)) {
+ pt->set(0, 0);
return 0;
}
@@ -147,6 +148,7 @@ SkScalar SkPoint::Length(SkScalar dx, SkScalar dy) {
bool SkPoint::setLength(float x, float y, float length) {
float mag2;
if (isLengthNearlyZero(x, y, &mag2)) {
+ this->set(0, 0);
return false;
}
@@ -183,6 +185,7 @@ bool SkPoint::setLengthFast(float length) {
bool SkPoint::setLengthFast(float x, float y, float length) {
float mag2;
if (isLengthNearlyZero(x, y, &mag2)) {
+ this->set(0, 0);
return false;
}
« no previous file with comments | « src/core/SkPath.cpp ('k') | tests/PointTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698