Chromium Code Reviews| 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; |