| Index: src/core/SkScaleToSides.h
|
| diff --git a/src/core/SkScaleToSides.h b/src/core/SkScaleToSides.h
|
| index 77637a3ac2c039da4794369dab0561c810470d5c..c3fa172f672588d27c29e95436c0bc0320d05f3c 100644
|
| --- a/src/core/SkScaleToSides.h
|
| +++ b/src/core/SkScaleToSides.h
|
| @@ -14,7 +14,7 @@
|
|
|
| class ScaleToSides {
|
| public:
|
| - // This code assumes that a and b fit in in a float, and therefore the resulting smaller value
|
| + // This code assumes that a and b fit in a float, and therefore the resulting smaller value
|
| // of a and b will fit in a float. The side of the rectangle may be larger than a float.
|
| // Scale must be less than or equal to the ratio limit / (*a + *b).
|
| // This code assumes that NaN and Inf are never passed in.
|
| @@ -24,8 +24,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 +47,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
|
|
|