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_INSETS_H_ | 5 #ifndef UI_GFX_GEOMETRY_INSETS_H_ |
6 #define UI_GFX_GEOMETRY_INSETS_H_ | 6 #define UI_GFX_GEOMETRY_INSETS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 } | 27 } |
28 | 28 |
29 Insets Scale(float x_scale, float y_scale) const { | 29 Insets Scale(float x_scale, float y_scale) const { |
30 return Insets(static_cast<int>(top() * y_scale), | 30 return Insets(static_cast<int>(top() * y_scale), |
31 static_cast<int>(left() * x_scale), | 31 static_cast<int>(left() * x_scale), |
32 static_cast<int>(bottom() * y_scale), | 32 static_cast<int>(bottom() * y_scale), |
33 static_cast<int>(right() * x_scale)); | 33 static_cast<int>(right() * x_scale)); |
34 } | 34 } |
35 | 35 |
36 operator InsetsF() const { | 36 operator InsetsF() const { |
37 return InsetsF(top(), left(), bottom(), right()); | 37 return InsetsF(static_cast<float>(top()), static_cast<float>(left()), |
danakj
2014/10/18 18:40:06
i really wanna remove these int->float operators,
Peter Kasting
2014/10/20 23:38:56
I don't have an opinion, other than that I'd rathe
danakj
2014/10/23 15:35:44
Sorry ya I didn't mean in this patch, just griping
| |
38 static_cast<float>(bottom()), static_cast<float>(right())); | |
38 } | 39 } |
39 | 40 |
40 // Returns a string representation of the insets. | 41 // Returns a string representation of the insets. |
41 std::string ToString() const; | 42 std::string ToString() const; |
42 }; | 43 }; |
43 | 44 |
44 #if !defined(COMPILER_MSVC) && !defined(__native_client__) | 45 #if !defined(COMPILER_MSVC) && !defined(__native_client__) |
45 extern template class InsetsBase<Insets, int>; | 46 extern template class InsetsBase<Insets, int>; |
46 #endif | 47 #endif |
47 | 48 |
48 } // namespace gfx | 49 } // namespace gfx |
49 | 50 |
50 #endif // UI_GFX_GEOMETRY_INSETS_H_ | 51 #endif // UI_GFX_GEOMETRY_INSETS_H_ |
OLD | NEW |