| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 * (i.e. left <= right) so the result may be negative. | 68 * (i.e. left <= right) so the result may be negative. |
| 69 */ | 69 */ |
| 70 int width() const { return fRight - fLeft; } | 70 int width() const { return fRight - fLeft; } |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Returns the rectangle's height. This does not check for a valid rect | 73 * Returns the rectangle's height. This does not check for a valid rect |
| 74 * (i.e. top <= bottom) so the result may be negative. | 74 * (i.e. top <= bottom) so the result may be negative. |
| 75 */ | 75 */ |
| 76 int height() const { return fBottom - fTop; } | 76 int height() const { return fBottom - fTop; } |
| 77 | 77 |
| 78 SkISize size() const { return SkISize::Make(this->width(), this->height());
} |
| 79 |
| 78 /** | 80 /** |
| 79 * Since the center of an integer rect may fall on a factional value, this | 81 * Since the center of an integer rect may fall on a factional value, this |
| 80 * method is defined to return (right + left) >> 1. | 82 * method is defined to return (right + left) >> 1. |
| 81 * | 83 * |
| 82 * This is a specific "truncation" of the average, which is different than | 84 * This is a specific "truncation" of the average, which is different than |
| 83 * (right + left) / 2 when the sum is negative. | 85 * (right + left) / 2 when the sum is negative. |
| 84 */ | 86 */ |
| 85 int centerX() const { return (fRight + fLeft) >> 1; } | 87 int centerX() const { return (fRight + fLeft) >> 1; } |
| 86 | 88 |
| 87 /** | 89 /** |
| (...skipping 775 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 |