| 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 * | 831 * |
| 832 * e.g. | 832 * e.g. |
| 833 * SkScalar x = 0.49999997f; | 833 * SkScalar x = 0.49999997f; |
| 834 * int ix = SkScalarRoundToInt(x); | 834 * int ix = SkScalarRoundToInt(x); |
| 835 * SkASSERT(0 == ix); // <--- fails | 835 * SkASSERT(0 == ix); // <--- fails |
| 836 * ix = SkDScalarRoundToInt(x); | 836 * ix = SkDScalarRoundToInt(x); |
| 837 * SkASSERT(0 == ix); // <--- succeeds | 837 * SkASSERT(0 == ix); // <--- succeeds |
| 838 */ | 838 */ |
| 839 void dround(SkIRect* dst) const { | 839 void dround(SkIRect* dst) const { |
| 840 SkASSERT(dst); | 840 SkASSERT(dst); |
| 841 dst->set(SkDScalarRoundToInt(fLeft), SkDScalarRoundToInt(fTop), | 841 dst->set(SkDScalarRoundDownToInt(fLeft), SkDScalarRoundDownToInt(fTop), |
| 842 SkDScalarRoundToInt(fRight), SkDScalarRoundToInt(fBottom)); | 842 SkDScalarRoundToInt(fRight), SkDScalarRoundToInt(fBottom)); |
| 843 } | 843 } |
| 844 | 844 |
| 845 /** | 845 /** |
| 846 * Set the dst rectangle by rounding "out" this rectangle, choosing the | 846 * Set the dst rectangle by rounding "out" this rectangle, choosing the |
| 847 * SkScalarFloor of top and left, and the SkScalarCeil of right and bottom. | 847 * SkScalarFloor of top and left, and the SkScalarCeil of right and bottom. |
| 848 */ | 848 */ |
| 849 void roundOut(SkIRect* dst) const { | 849 void roundOut(SkIRect* dst) const { |
| 850 SkASSERT(dst); | 850 SkASSERT(dst); |
| 851 dst->set(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), | 851 dst->set(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 void dumpHex() const { this->dump(true); } | 917 void dumpHex() const { this->dump(true); } |
| 918 }; | 918 }; |
| 919 | 919 |
| 920 inline bool SkIRect::contains(const SkRect& r) const { | 920 inline bool SkIRect::contains(const SkRect& r) const { |
| 921 return !r.isEmpty() && !this->isEmpty() && // check for empties | 921 return !r.isEmpty() && !this->isEmpty() && // check for empties |
| 922 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && | 922 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && |
| 923 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; | 923 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; |
| 924 } | 924 } |
| 925 | 925 |
| 926 #endif | 926 #endif |
| OLD | NEW |