Tested with -fsanitize=signed-integer-overflow.
This new assert used to trigger in MipMap unit test.
Don't appear to be any GM diffs.
BUG=skia:
Review URL: https://codereview.chromium.org/
729373004
}
static inline int32_t SkAbs32(int32_t value) {
+ SkASSERT(value != SK_NaN32); // The most negative int32_t can't be negated.
if (value < 0) {
value = -value;
}
//static int gCounter;
static SkFixed compute_level(SkScalar scale) {
- SkFixed s = SkAbs32(SkScalarToFixed(SkScalarInvert(scale)));
+ SkScalar inv = SkScalarAbs(SkScalarInvert(scale));
+ if (inv > 32767) { // Watch out for SkFixed overflow.
+ inv = 32767;
+ }
+ SkFixed s = SkScalarToFixed(inv);
if (s < SK_Fixed1) {
return 0;