Rewrite NaN checks in terms of SkScalarIsNaN()

We are trying to replace Skia's NaN checker with our own in Mozilla,
so it would be nice to have to patch a single place by making sure
these NaN checks used SkScalarIsNaN().

BUG=skia:

Review URL: https://codereview.chromium.org/809443002
This commit is contained in:
ehsan.akhgari 2014-12-15 12:08:47 -08:00 committed by Commit bot
parent 3fcc125c77
commit 6f90475632
3 changed files with 5 additions and 5 deletions

View File

@ -357,11 +357,11 @@ struct SK_API SkPoint {
accum *= fY; accum *= fY;
// accum is either NaN or it is finite (zero). // accum is either NaN or it is finite (zero).
SkASSERT(0 == accum || !(accum == accum)); SkASSERT(0 == accum || SkScalarIsNaN(accum));
// value==value will be true iff value is not NaN // value==value will be true iff value is not NaN
// TODO: is it faster to say !accum or accum==accum? // TODO: is it faster to say !accum or accum==accum?
return accum == accum; return !SkScalarIsNaN(accum);
} }
/** /**

View File

@ -455,11 +455,11 @@ struct SK_API SkRect {
accum *= fBottom; accum *= fBottom;
// accum is either NaN or it is finite (zero). // accum is either NaN or it is finite (zero).
SkASSERT(0 == accum || !(accum == accum)); SkASSERT(0 == accum || SkScalarIsNaN(accum));
// value==value will be true iff value is not NaN // value==value will be true iff value is not NaN
// TODO: is it faster to say !accum or accum==accum? // TODO: is it faster to say !accum or accum==accum?
return accum == accum; return !SkScalarIsNaN(accum);
} }
SkScalar x() const { return fLeft; } SkScalar x() const { return fLeft; }

View File

@ -127,7 +127,7 @@ static inline bool SkScalarIsFinite(SkScalar x) {
SkScalar prod = x * 0; SkScalar prod = x * 0;
// At this point, prod will either be NaN or 0 // At this point, prod will either be NaN or 0
// Therefore we can return (prod == prod) or (0 == prod). // Therefore we can return (prod == prod) or (0 == prod).
return prod == prod; return !SkScalarIsNaN(prod);
} }
/** /**