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_POINT_H_ | 5 #ifndef UI_GFX_POINT_H_ |
6 #define UI_GFX_POINT_H_ | 6 #define UI_GFX_POINT_H_ |
7 | 7 |
8 #include "ui/base/ui_export.h" | 8 #include "ui/base/ui_export.h" |
9 #include "ui/gfx/point_base.h" | 9 #include "ui/gfx/point_base.h" |
10 #include "ui/gfx/point_f.h" | 10 #include "ui/gfx/point_f.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
43 POINT ToPOINT() const; | 43 POINT ToPOINT() const; |
44 #elif defined(OS_MACOSX) | 44 #elif defined(OS_MACOSX) |
45 CGPoint ToCGPoint() const; | 45 CGPoint ToCGPoint() const; |
46 #endif | 46 #endif |
47 | 47 |
48 operator PointF() const { | 48 operator PointF() const { |
49 return PointF(x(), y()); | 49 return PointF(x(), y()); |
50 } | 50 } |
51 | 51 |
52 PointF Scale(float scale) const WARN_UNUSED_RESULT { | |
53 return Scale(scale, scale); | |
54 } | |
55 | |
56 PointF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT { | |
57 return PointF(x() * x_scale, y() * y_scale); | |
58 } | |
59 | |
60 // Returns a string representation of point. | 52 // Returns a string representation of point. |
61 std::string ToString() const; | 53 std::string ToString() const; |
62 }; | 54 }; |
63 | 55 |
64 inline bool operator==(const Point& lhs, const Point& rhs) { | 56 inline bool operator==(const Point& lhs, const Point& rhs) { |
65 return lhs.x() == rhs.x() && lhs.y() == rhs.y(); | 57 return lhs.x() == rhs.x() && lhs.y() == rhs.y(); |
66 } | 58 } |
67 | 59 |
68 inline bool operator!=(const Point& lhs, const Point& rhs) { | 60 inline bool operator!=(const Point& lhs, const Point& rhs) { |
69 return !(lhs == rhs); | 61 return !(lhs == rhs); |
(...skipping 15 matching lines...) Expand all Loading... |
85 return Point(offset_from_origin.x(), offset_from_origin.y()); | 77 return Point(offset_from_origin.x(), offset_from_origin.y()); |
86 } | 78 } |
87 | 79 |
88 #if !defined(COMPILER_MSVC) | 80 #if !defined(COMPILER_MSVC) |
89 extern template class PointBase<Point, int, Vector2d>; | 81 extern template class PointBase<Point, int, Vector2d>; |
90 #endif | 82 #endif |
91 | 83 |
92 } // namespace gfx | 84 } // namespace gfx |
93 | 85 |
94 #endif // UI_GFX_POINT_H_ | 86 #endif // UI_GFX_POINT_H_ |
OLD | NEW |