OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkRect_DEFINED | 8 #ifndef SkRect_DEFINED |
9 #define SkRect_DEFINED | 9 #define SkRect_DEFINED |
10 | 10 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 */ | 456 */ |
457 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } | 457 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } |
458 | 458 |
459 bool isLargest() const { return SK_ScalarMin == fLeft && | 459 bool isLargest() const { return SK_ScalarMin == fLeft && |
460 SK_ScalarMin == fTop && | 460 SK_ScalarMin == fTop && |
461 SK_ScalarMax == fRight && | 461 SK_ScalarMax == fRight && |
462 SK_ScalarMax == fBottom; } | 462 SK_ScalarMax == fBottom; } |
463 | 463 |
464 /** | 464 /** |
465 * Returns true iff all values in the rect are finite. If any are | 465 * Returns true iff all values in the rect are finite. If any are |
466 * infinite or NaN then this returns false. | 466 * infinite or NaN (or SK_FixedNaN when SkScalar is fixed) then this |
| 467 * returns false. |
467 */ | 468 */ |
468 bool isFinite() const { | 469 bool isFinite() const { |
469 float accum = 0; | 470 float accum = 0; |
470 accum *= fLeft; | 471 accum *= fLeft; |
471 accum *= fTop; | 472 accum *= fTop; |
472 accum *= fRight; | 473 accum *= fRight; |
473 accum *= fBottom; | 474 accum *= fBottom; |
474 | 475 |
475 // accum is either NaN or it is finite (zero). | 476 // accum is either NaN or it is finite (zero). |
476 SkASSERT(0 == accum || SkScalarIsNaN(accum)); | 477 SkASSERT(0 == accum || SkScalarIsNaN(accum)); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 void dumpHex() const { this->dump(true); } | 899 void dumpHex() const { this->dump(true); } |
899 }; | 900 }; |
900 | 901 |
901 inline bool SkIRect::contains(const SkRect& r) const { | 902 inline bool SkIRect::contains(const SkRect& r) const { |
902 return !r.isEmpty() && !this->isEmpty() && // check for empties | 903 return !r.isEmpty() && !this->isEmpty() && // check for empties |
903 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && | 904 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && |
904 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; | 905 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; |
905 } | 906 } |
906 | 907 |
907 #endif | 908 #endif |
OLD | NEW |