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" |
11 #include "ui/base/ui_export.h" | 11 #include "ui/base/ui_export.h" |
12 #include "ui/gfx/size_base.h" | 12 #include "ui/gfx/size_base.h" |
13 #include "ui/gfx/size_f.h" | 13 #include "ui/gfx/size_f.h" |
| 14 #include "ui/gfx/vector2d.h" |
14 | 15 |
15 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
16 typedef struct tagSIZE SIZE; | 17 typedef struct tagSIZE SIZE; |
17 #elif defined(OS_IOS) | 18 #elif defined(OS_IOS) |
18 #include <CoreGraphics/CoreGraphics.h> | 19 #include <CoreGraphics/CoreGraphics.h> |
19 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
20 #include <ApplicationServices/ApplicationServices.h> | 21 #include <ApplicationServices/ApplicationServices.h> |
21 #endif | 22 #endif |
22 | 23 |
23 namespace gfx { | 24 namespace gfx { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 }; | 60 }; |
60 | 61 |
61 inline bool operator==(const Size& lhs, const Size& rhs) { | 62 inline bool operator==(const Size& lhs, const Size& rhs) { |
62 return lhs.width() == rhs.width() && lhs.height() == rhs.height(); | 63 return lhs.width() == rhs.width() && lhs.height() == rhs.height(); |
63 } | 64 } |
64 | 65 |
65 inline bool operator!=(const Size& lhs, const Size& rhs) { | 66 inline bool operator!=(const Size& lhs, const Size& rhs) { |
66 return !(lhs == rhs); | 67 return !(lhs == rhs); |
67 } | 68 } |
68 | 69 |
| 70 inline Size SizeOfVector2d(const Vector2d& v) { |
| 71 return Size(std::abs(v.x()), std::abs(v.y())); |
| 72 } |
| 73 |
69 #if !defined(COMPILER_MSVC) | 74 #if !defined(COMPILER_MSVC) |
70 extern template class SizeBase<Size, int>; | 75 extern template class SizeBase<Size, int>; |
71 #endif | 76 #endif |
72 | 77 |
73 } // namespace gfx | 78 } // namespace gfx |
74 | 79 |
75 #endif // UI_GFX_SIZE_H_ | 80 #endif // UI_GFX_SIZE_H_ |
OLD | NEW |