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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 void roundOut(SkIRect* dst) const { | 799 void roundOut(SkIRect* dst) const { |
800 SkASSERT(dst); | 800 SkASSERT(dst); |
801 dst->set(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), | 801 dst->set(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), |
802 SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)); | 802 SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)); |
803 } | 803 } |
804 | 804 |
805 /** | 805 /** |
806 * Expand this rectangle by rounding its coordinates "out", choosing the | 806 * Expand this rectangle by rounding its coordinates "out", choosing the |
807 * floor of top and left, and the ceil of right and bottom. If this rect | 807 * floor of top and left, and the ceil of right and bottom. If this rect |
808 * is already on integer coordinates, then it will be unchanged. | 808 * is already on integer coordinates, then it will be unchanged. |
| 809 * |
| 810 * It is safe for this == dst |
809 */ | 811 */ |
810 void roundOut() { | 812 void roundOut(SkRect* dst) const { |
811 this->set(SkScalarFloorToScalar(fLeft), | 813 dst->set(SkScalarFloorToScalar(fLeft), |
812 SkScalarFloorToScalar(fTop), | 814 SkScalarFloorToScalar(fTop), |
813 SkScalarCeilToScalar(fRight), | 815 SkScalarCeilToScalar(fRight), |
814 SkScalarCeilToScalar(fBottom)); | 816 SkScalarCeilToScalar(fBottom)); |
815 } | 817 } |
816 | 818 |
817 /** | 819 /** |
818 * Set the dst rectangle by rounding "in" this rectangle, choosing the | 820 * Set the dst rectangle by rounding "in" this rectangle, choosing the |
819 * ceil of top and left, and the floor of right and bottom. This does *not* | 821 * ceil of top and left, and the floor of right and bottom. This does *not* |
820 * call sort(), so it is possible that the resulting rect is inverted... | 822 * call sort(), so it is possible that the resulting rect is inverted... |
821 * e.g. left >= right or top >= bottom. Call isEmpty() to detect that. | 823 * e.g. left >= right or top >= bottom. Call isEmpty() to detect that. |
822 */ | 824 */ |
823 void roundIn(SkIRect* dst) const { | 825 void roundIn(SkIRect* dst) const { |
824 SkASSERT(dst); | 826 SkASSERT(dst); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 * rely on the existence of this function or the formatting of its output. | 865 * rely on the existence of this function or the formatting of its output. |
864 */ | 866 */ |
865 void dump() const { | 867 void dump() const { |
866 SkDebugf("{ l: %f, t: %f, r: %f, b: %f }", fLeft, fTop, fRight, fBottom)
; | 868 SkDebugf("{ l: %f, t: %f, r: %f, b: %f }", fLeft, fTop, fRight, fBottom)
; |
867 } | 869 } |
868 #endif | 870 #endif |
869 | 871 |
870 }; | 872 }; |
871 | 873 |
872 #endif | 874 #endif |
OLD | NEW |