| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Defines a simple integer rectangle class. The containment semantics | 5 // Defines a simple integer rectangle class. The containment semantics |
| 6 // are array-like; that is, the coordinate (x, y) is considered to be | 6 // are array-like; that is, the coordinate (x, y) is considered to be |
| 7 // contained by the rectangle, but the coordinate (x + width, y) is not. | 7 // contained by the rectangle, but the coordinate (x + width, y) is not. |
| 8 // The class will happily let you create malformed rectangles (that is, | 8 // The class will happily let you create malformed rectangles (that is, |
| 9 // rectangles with negative width and/or height), but there will be assertions | 9 // rectangles with negative width and/or height), but there will be assertions |
| 10 // in the operations (such as contain()) to complain in this case. | 10 // in the operations (such as contain()) to complain in this case. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 int width() const { return size_.width(); } | 58 int width() const { return size_.width(); } |
| 59 void set_width(int width); | 59 void set_width(int width); |
| 60 | 60 |
| 61 int height() const { return size_.height(); } | 61 int height() const { return size_.height(); } |
| 62 void set_height(int height); | 62 void set_height(int height); |
| 63 | 63 |
| 64 const gfx::Point& origin() const { return origin_; } | 64 const gfx::Point& origin() const { return origin_; } |
| 65 void set_origin(const gfx::Point& origin) { origin_ = origin; } | 65 void set_origin(const gfx::Point& origin) { origin_ = origin; } |
| 66 | 66 |
| 67 const gfx::Size& size() const { return size_; } | 67 const gfx::Size& size() const { return size_; } |
| 68 void set_size(const gfx::Size& size) { size_ = size; } |
| 68 | 69 |
| 69 int right() const { return x() + width(); } | 70 int right() const { return x() + width(); } |
| 70 int bottom() const { return y() + height(); } | 71 int bottom() const { return y() + height(); } |
| 71 | 72 |
| 72 void SetRect(int x, int y, int width, int height); | 73 void SetRect(int x, int y, int width, int height); |
| 73 | 74 |
| 74 // Shrink the rectangle by a horizontal and vertical distance on all sides. | 75 // Shrink the rectangle by a horizontal and vertical distance on all sides. |
| 75 void Inset(int horizontal, int vertical) { | 76 void Inset(int horizontal, int vertical) { |
| 76 Inset(horizontal, vertical, horizontal, vertical); | 77 Inset(horizontal, vertical, horizontal, vertical); |
| 77 } | 78 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 private: | 152 private: |
| 152 gfx::Point origin_; | 153 gfx::Point origin_; |
| 153 gfx::Size size_; | 154 gfx::Size size_; |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 } // namespace gfx | 157 } // namespace gfx |
| 157 | 158 |
| 158 std::ostream& operator<<(std::ostream& out, const gfx::Rect& r); | 159 std::ostream& operator<<(std::ostream& out, const gfx::Rect& r); |
| 159 | 160 |
| 160 #endif // BASE_GFX_RECT_H__ | 161 #endif // BASE_GFX_RECT_H__ |
| OLD | NEW |