OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef BASE_GFX_SIZE_H__ | 5 #ifndef BASE_GFX_SIZE_H__ |
6 #define BASE_GFX_SIZE_H__ | 6 #define BASE_GFX_SIZE_H__ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #ifdef UNIT_TEST | 10 #ifdef UNIT_TEST |
(...skipping 19 matching lines...) Expand all Loading... |
30 ~Size() {} | 30 ~Size() {} |
31 | 31 |
32 int width() const { return width_; } | 32 int width() const { return width_; } |
33 int height() const { return height_; } | 33 int height() const { return height_; } |
34 | 34 |
35 void SetSize(int width, int height) { | 35 void SetSize(int width, int height) { |
36 width_ = width; | 36 width_ = width; |
37 height_ = height; | 37 height_ = height; |
38 } | 38 } |
39 | 39 |
| 40 void Enlarge(int width, int height) { |
| 41 width_ += width; |
| 42 height_ += height; |
| 43 } |
| 44 |
40 void set_width(int width) { width_ = width; } | 45 void set_width(int width) { width_ = width; } |
41 void set_height(int height) { height_ = height; } | 46 void set_height(int height) { height_ = height; } |
42 | 47 |
43 bool operator==(const Size& s) const { | 48 bool operator==(const Size& s) const { |
44 return width_ == s.width_ && height_ == s.height_; | 49 return width_ == s.width_ && height_ == s.height_; |
45 } | 50 } |
46 | 51 |
47 bool operator!=(const Size& s) const { | 52 bool operator!=(const Size& s) const { |
48 return !(*this == s); | 53 return !(*this == s); |
49 } | 54 } |
(...skipping 18 matching lines...) Expand all Loading... |
68 #ifdef UNIT_TEST | 73 #ifdef UNIT_TEST |
69 | 74 |
70 inline std::ostream& operator<<(std::ostream& out, const gfx::Size& s) { | 75 inline std::ostream& operator<<(std::ostream& out, const gfx::Size& s) { |
71 return out << s.width() << "x" << s.height(); | 76 return out << s.width() << "x" << s.height(); |
72 } | 77 } |
73 | 78 |
74 #endif // #ifdef UNIT_TEST | 79 #endif // #ifdef UNIT_TEST |
75 | 80 |
76 #endif // BASE_GFX_SIZE_H__ | 81 #endif // BASE_GFX_SIZE_H__ |
77 | 82 |
OLD | NEW |