| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 /** | 151 /** |
| 152 * Make the largest representable rectangle, but inverted (e.g. fLeft will | 152 * Make the largest representable rectangle, but inverted (e.g. fLeft will |
| 153 * be max 32bit and right will be min 32bit). | 153 * be max 32bit and right will be min 32bit). |
| 154 */ | 154 */ |
| 155 void setLargestInverted() { | 155 void setLargestInverted() { |
| 156 fLeft = fTop = SK_MaxS32; | 156 fLeft = fTop = SK_MaxS32; |
| 157 fRight = fBottom = SK_MinS32; | 157 fRight = fBottom = SK_MinS32; |
| 158 } | 158 } |
| 159 | 159 |
| 160 /** |
| 161 * Return a new IRect, built as an offset of this rect. |
| 162 */ |
| 163 SkIRect makeOffset(int dx, int dy) const { |
| 164 return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy); |
| 165 } |
| 166 |
| 167 /** |
| 168 * Return a new IRect, built as an inset of this rect. |
| 169 */ |
| 170 SkIRect makeInset(int dx, int dy) const { |
| 171 return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy); |
| 172 } |
| 173 |
| 160 /** Offset set the rectangle by adding dx to its left and right, | 174 /** Offset set the rectangle by adding dx to its left and right, |
| 161 and adding dy to its top and bottom. | 175 and adding dy to its top and bottom. |
| 162 */ | 176 */ |
| 163 void offset(int32_t dx, int32_t dy) { | 177 void offset(int32_t dx, int32_t dy) { |
| 164 fLeft += dx; | 178 fLeft += dx; |
| 165 fTop += dy; | 179 fTop += dy; |
| 166 fRight += dx; | 180 fRight += dx; |
| 167 fBottom += dy; | 181 fBottom += dy; |
| 168 } | 182 } |
| 169 | 183 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 584 |
| 571 /** | 585 /** |
| 572 * Make the largest representable rectangle, but inverted (e.g. fLeft will | 586 * Make the largest representable rectangle, but inverted (e.g. fLeft will |
| 573 * be max and right will be min). | 587 * be max and right will be min). |
| 574 */ | 588 */ |
| 575 void setLargestInverted() { | 589 void setLargestInverted() { |
| 576 fLeft = fTop = SK_ScalarMax; | 590 fLeft = fTop = SK_ScalarMax; |
| 577 fRight = fBottom = SK_ScalarMin; | 591 fRight = fBottom = SK_ScalarMin; |
| 578 } | 592 } |
| 579 | 593 |
| 594 /** |
| 595 * Return a new Rect, built as an offset of this rect. |
| 596 */ |
| 597 SkRect makeOffset(SkScalar dx, SkScalar dy) const { |
| 598 return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy); |
| 599 } |
| 600 |
| 601 /** |
| 602 * Return a new Rect, built as an inset of this rect. |
| 603 */ |
| 604 SkRect makeInset(SkScalar dx, SkScalar dy) const { |
| 605 return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy); |
| 606 } |
| 607 |
| 580 /** Offset set the rectangle by adding dx to its left and right, | 608 /** Offset set the rectangle by adding dx to its left and right, |
| 581 and adding dy to its top and bottom. | 609 and adding dy to its top and bottom. |
| 582 */ | 610 */ |
| 583 void offset(SkScalar dx, SkScalar dy) { | 611 void offset(SkScalar dx, SkScalar dy) { |
| 584 fLeft += dx; | 612 fLeft += dx; |
| 585 fTop += dy; | 613 fTop += dy; |
| 586 fRight += dx; | 614 fRight += dx; |
| 587 fBottom += dy; | 615 fBottom += dy; |
| 588 } | 616 } |
| 589 | 617 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 */ | 829 */ |
| 802 void sort(); | 830 void sort(); |
| 803 | 831 |
| 804 /** | 832 /** |
| 805 * cast-safe way to treat the rect as an array of (4) SkScalars. | 833 * cast-safe way to treat the rect as an array of (4) SkScalars. |
| 806 */ | 834 */ |
| 807 const SkScalar* asScalars() const { return &fLeft; } | 835 const SkScalar* asScalars() const { return &fLeft; } |
| 808 }; | 836 }; |
| 809 | 837 |
| 810 #endif | 838 #endif |
| OLD | NEW |