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_SIZE_H_ | 5 #ifndef UI_GFX_SIZE_H_ |
6 #define UI_GFX_SIZE_H_ | 6 #define UI_GFX_SIZE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
41 SIZE ToSIZE() const; | 41 SIZE ToSIZE() const; |
42 #elif defined(OS_MACOSX) | 42 #elif defined(OS_MACOSX) |
43 CGSize ToCGSize() const; | 43 CGSize ToCGSize() const; |
44 #endif | 44 #endif |
45 | 45 |
46 operator SizeF() const { | 46 operator SizeF() const { |
47 return SizeF(width(), height()); | 47 return SizeF(width(), height()); |
48 } | 48 } |
49 | 49 |
50 SizeF Scale(float scale) const WARN_UNUSED_RESULT { | |
51 return Scale(scale, scale); | |
52 } | |
53 | |
54 SizeF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT { | |
55 return SizeF(width() * x_scale, height() * y_scale); | |
56 } | |
57 | |
58 std::string ToString() const; | 50 std::string ToString() const; |
59 }; | 51 }; |
60 | 52 |
61 inline bool operator==(const Size& lhs, const Size& rhs) { | 53 inline bool operator==(const Size& lhs, const Size& rhs) { |
62 return lhs.width() == rhs.width() && lhs.height() == rhs.height(); | 54 return lhs.width() == rhs.width() && lhs.height() == rhs.height(); |
63 } | 55 } |
64 | 56 |
65 inline bool operator!=(const Size& lhs, const Size& rhs) { | 57 inline bool operator!=(const Size& lhs, const Size& rhs) { |
66 return !(lhs == rhs); | 58 return !(lhs == rhs); |
67 } | 59 } |
68 | 60 |
69 #if !defined(COMPILER_MSVC) | 61 #if !defined(COMPILER_MSVC) |
70 extern template class SizeBase<Size, int>; | 62 extern template class SizeBase<Size, int>; |
71 #endif | 63 #endif |
72 | 64 |
73 } // namespace gfx | 65 } // namespace gfx |
74 | 66 |
75 #endif // UI_GFX_SIZE_H_ | 67 #endif // UI_GFX_SIZE_H_ |
OLD | NEW |