OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_GFX_GEOMETRY_SIZE_H_ | 5 #ifndef UI_GFX_GEOMETRY_SIZE_H_ |
6 #define UI_GFX_GEOMETRY_SIZE_H_ | 6 #define UI_GFX_GEOMETRY_SIZE_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 #elif defined(OS_MACOSX) | 40 #elif defined(OS_MACOSX) |
41 CGSize ToCGSize() const; | 41 CGSize ToCGSize() const; |
42 #endif | 42 #endif |
43 | 43 |
44 int width() const { return width_; } | 44 int width() const { return width_; } |
45 int height() const { return height_; } | 45 int height() const { return height_; } |
46 | 46 |
47 void set_width(int width) { width_ = width < 0 ? 0 : width; } | 47 void set_width(int width) { width_ = width < 0 ? 0 : width; } |
48 void set_height(int height) { height_ = height < 0 ? 0 : height; } | 48 void set_height(int height) { height_ = height < 0 ? 0 : height; } |
49 | 49 |
| 50 // This call will CHECK if the area of this size would overflow int. |
50 int GetArea() const; | 51 int GetArea() const; |
51 | 52 |
52 void SetSize(int width, int height) { | 53 void SetSize(int width, int height) { |
53 set_width(width); | 54 set_width(width); |
54 set_height(height); | 55 set_height(height); |
55 } | 56 } |
56 | 57 |
57 void Enlarge(int grow_width, int grow_height); | 58 void Enlarge(int grow_width, int grow_height); |
58 | 59 |
59 void SetToMin(const Size& other); | 60 void SetToMin(const Size& other); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 float y_scale); | 92 float y_scale); |
92 GFX_EXPORT Size ScaleToFlooredSize(const Size& size, float x_scale); | 93 GFX_EXPORT Size ScaleToFlooredSize(const Size& size, float x_scale); |
93 GFX_EXPORT Size ScaleToRoundedSize(const Size& size, | 94 GFX_EXPORT Size ScaleToRoundedSize(const Size& size, |
94 float x_scale, | 95 float x_scale, |
95 float y_scale); | 96 float y_scale); |
96 GFX_EXPORT Size ScaleToRoundedSize(const Size& size, float x_scale); | 97 GFX_EXPORT Size ScaleToRoundedSize(const Size& size, float x_scale); |
97 | 98 |
98 } // namespace gfx | 99 } // namespace gfx |
99 | 100 |
100 #endif // UI_GFX_GEOMETRY_SIZE_H_ | 101 #endif // UI_GFX_GEOMETRY_SIZE_H_ |
OLD | NEW |