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

Unified Diff: src/core/SkPoint.cpp

Issue 373383003: ios fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: give shell its own gyp file Created 6 years, 5 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
Index: src/core/SkPoint.cpp
diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp
index 719ee54b225ae72e57ee6752ab22a107178adc66..70406f1e123346fd2ac6bbc6a8bc4069afaf6440 100644
--- a/src/core/SkPoint.cpp
+++ b/src/core/SkPoint.cpp
@@ -168,7 +168,17 @@ bool SkPoint::setLength(float x, float y, float length) {
// divide by inf. and return (0,0) vector.
double xx = x;
double yy = y;
+ #ifdef SK_FAST_UNDERFLOW_BEHAVIOR
+ // The iOS ARM processor discards small denormalized numbers to go faster.
reed1 2014/07/10 21:40:05 I think this comment belongs in SkMathPriv.h or wh
caryclark 2014/07/11 12:57:19 Done.
+ // Casting this to a float would cause the scale to go to zero. Keeping it
+ // as a double for the multipy keeps the scale non-zero.
+ double dscale = length / sqrt(xx * xx + yy * yy);
+ fX = x * dscale;
+ fY = y * dscale;
+ return true;
+ #else
scale = (float)(length / sqrt(xx * xx + yy * yy));
+ #endif
}
fX = x * scale;
fY = y * scale;

Powered by Google App Engine
This is Rietveld 408576698