| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkRect_DEFINED | 10 #ifndef SkRect_DEFINED |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 SkScalar centerY() const { return SkScalarHalf(fTop + fBottom); } | 459 SkScalar centerY() const { return SkScalarHalf(fTop + fBottom); } |
| 460 | 460 |
| 461 friend bool operator==(const SkRect& a, const SkRect& b) { | 461 friend bool operator==(const SkRect& a, const SkRect& b) { |
| 462 return SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); | 462 return SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); |
| 463 } | 463 } |
| 464 | 464 |
| 465 friend bool operator!=(const SkRect& a, const SkRect& b) { | 465 friend bool operator!=(const SkRect& a, const SkRect& b) { |
| 466 return !SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); | 466 return !SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); |
| 467 } | 467 } |
| 468 | 468 |
| 469 /** return the 4 points that enclose the rectangle | 469 /** return the 4 points that enclose the rectangle (top-left, top-right, bot
tom-right, |
| 470 */ | 470 bottom-left). TODO: Consider adding param to control whether quad is CW
or CCW. |
| 471 */ |
| 471 void toQuad(SkPoint quad[4]) const; | 472 void toQuad(SkPoint quad[4]) const; |
| 472 | 473 |
| 473 /** Set this rectangle to the empty rectangle (0,0,0,0) | 474 /** Set this rectangle to the empty rectangle (0,0,0,0) |
| 474 */ | 475 */ |
| 475 void setEmpty() { memset(this, 0, sizeof(*this)); } | 476 void setEmpty() { memset(this, 0, sizeof(*this)); } |
| 476 | 477 |
| 477 void set(const SkIRect& src) { | 478 void set(const SkIRect& src) { |
| 478 fLeft = SkIntToScalar(src.fLeft); | 479 fLeft = SkIntToScalar(src.fLeft); |
| 479 fTop = SkIntToScalar(src.fTop); | 480 fTop = SkIntToScalar(src.fTop); |
| 480 fRight = SkIntToScalar(src.fRight); | 481 fRight = SkIntToScalar(src.fRight); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 */ | 782 */ |
| 782 void sort(); | 783 void sort(); |
| 783 | 784 |
| 784 /** | 785 /** |
| 785 * cast-safe way to treat the rect as an array of (4) SkScalars. | 786 * cast-safe way to treat the rect as an array of (4) SkScalars. |
| 786 */ | 787 */ |
| 787 const SkScalar* asScalars() const { return &fLeft; } | 788 const SkScalar* asScalars() const { return &fLeft; } |
| 788 }; | 789 }; |
| 789 | 790 |
| 790 #endif | 791 #endif |
| OLD | NEW |