Chromium Code Reviews| Index: src/core/SkScaleToSides.h |
| diff --git a/src/core/SkScaleToSides.h b/src/core/SkScaleToSides.h |
| index 77637a3ac2c039da4794369dab0561c810470d5c..de1e9e03381fac5c1685ff797b4f1767c215d10a 100644 |
| --- a/src/core/SkScaleToSides.h |
| +++ b/src/core/SkScaleToSides.h |
| @@ -9,6 +9,7 @@ |
| #define SkScaleToSides_DEFINED |
| #include <cmath> |
|
robertphillips
2016/01/22 14:42:51
Do we actually need <limits> ?
herb_g
2016/01/22 16:01:05
Done.
|
| +#include <limits> |
| #include "SkScalar.h" |
| #include "SkTypes.h" |
| @@ -24,8 +25,7 @@ public: |
| *a = (float)((double)*a * scale); |
| *b = (float)((double)*b * scale); |
| - // This check is conservative. (double)*a + (double)*b >= (double)(*a + *b) |
| - if ((double)*a + (double)*b > limit) { |
| + if (*a + *b > limit) { |
| float* minRadius = a; |
| float* maxRadius = b; |
| @@ -48,14 +48,16 @@ public: |
| // reduced by one ULP to be less than limit - newMinRadius. |
| // Note: nexttowardf is a c99 call and should be std::nexttoward, but this is not |
| // implemented in the ARM compiler. |
| - if ((double)newMaxRadius + (double)newMinRadius > limit) { |
| + if (newMaxRadius + newMinRadius > limit) { |
| newMaxRadius = nexttowardf(newMaxRadius, 0.0); |
| } |
| *maxRadius = newMaxRadius; |
| } |
| - SkASSERTF(*a >= 0.0f && *b >= 0.0f, "a: %g, b: %g", *a, *b); |
| - SkASSERTF((*a + *b) <= limit, "limit: %g, a: %g, b: %g", limit, *a, *b); |
| + SkASSERTF(*a >= 0.0f && *b >= 0.0f, "a: %g, b: %g, limit: %g, scale: %g", *a, *b, limit, |
| + scale); |
| + SkASSERTF(*a + *b <= limit, "\nlimit: %.10f, a: %.10f, b: %.10f, scale: %.20f", |
| + limit, *a, *b, scale); |
| } |
| }; |
| #endif // ScaleToSides_DEFINED |