diff options
author | Brian Salomon <bsalomon@google.com> | 2017-05-09 18:09:28 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-10 12:53:32 +0000 |
commit | 1ffda0484d87cd44afcd7387618f4a369ba3cd23 (patch) | |
tree | 1769b36dc31b3372202b2bda3d9a6647951c4482 /src/gpu/GrRect.h | |
parent | f55a62b03bc14e101c931145aac6191748fc21be (diff) |
allow inf/nan in GrRect isect utility functions.
Separately we may want to determine why we get NaNs here in flutter.
Bug: skia:6607
Change-Id: Id90fff1ccf487794d55dc011b1a2d176cedb931a
Reviewed-on: https://skia-review.googlesource.com/16342
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrRect.h')
-rw-r--r-- | src/gpu/GrRect.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gpu/GrRect.h b/src/gpu/GrRect.h index 1e6f83b69e..95102a837b 100644 --- a/src/gpu/GrRect.h +++ b/src/gpu/GrRect.h @@ -57,16 +57,18 @@ struct GrIRect16 { /** Returns true if the rectangles have a nonzero area of overlap. It assumed that rects can be infinitely small but not "inverted". */ static inline bool GrRectsOverlap(const SkRect& a, const SkRect& b) { - SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom); - SkASSERT(b.fLeft <= b.fRight && b.fTop <= b.fBottom); + // See skbug.com/6607 about the isFinite() checks. + SkASSERT(!a.isFinite() || (a.fLeft <= a.fRight && a.fTop <= a.fBottom)); + SkASSERT(!b.isFinite() || (b.fLeft <= b.fRight && b.fTop <= b.fBottom)); return a.fRight > b.fLeft && a.fBottom > b.fTop && b.fRight > a.fLeft && b.fBottom > a.fTop; } /** Returns true if the rectangles overlap or share an edge or corner. It assumed that rects can be infinitely small but not "inverted". */ static inline bool GrRectsTouchOrOverlap(const SkRect& a, const SkRect& b) { - SkASSERT(a.fLeft <= a.fRight && a.fTop <= a.fBottom); - SkASSERT(b.fLeft <= b.fRight && b.fTop <= b.fBottom); + // See skbug.com/6607 about the isFinite() checks. + SkASSERT(!a.isFinite() || (a.fLeft <= a.fRight && a.fTop <= a.fBottom)); + SkASSERT(!b.isFinite() || (b.fLeft <= b.fRight && b.fTop <= b.fBottom)); return a.fRight >= b.fLeft && a.fBottom >= b.fTop && b.fRight >= a.fLeft && b.fBottom >= a.fTop; } #endif |