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 30 matching lines...) Expand all Loading... |
41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
42 POINT ToPOINT() const; | 42 POINT ToPOINT() const; |
43 #elif defined(OS_MACOSX) | 43 #elif defined(OS_MACOSX) |
44 CGPoint ToCGPoint() const; | 44 CGPoint ToCGPoint() const; |
45 #endif | 45 #endif |
46 | 46 |
47 PointF ToPointF() const { | 47 PointF ToPointF() const { |
48 return PointF(x(), y()); | 48 return PointF(x(), y()); |
49 } | 49 } |
50 | 50 |
| 51 PointF Scale(float scale) const WARN_UNUSED_RESULT { |
| 52 return Scale(scale, scale); |
| 53 } |
| 54 |
| 55 PointF Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT { |
| 56 return PointF(x() * x_scale, y() * y_scale); |
| 57 } |
| 58 |
51 // Returns a string representation of point. | 59 // Returns a string representation of point. |
52 std::string ToString() const; | 60 std::string ToString() const; |
53 }; | 61 }; |
54 | 62 |
55 inline Point operator+(Point lhs, Point rhs) { | 63 inline Point operator+(Point lhs, Point rhs) { |
56 return lhs.Add(rhs); | 64 return lhs.Add(rhs); |
57 } | 65 } |
58 | 66 |
59 inline Point operator-(Point lhs, Point rhs) { | 67 inline Point operator-(Point lhs, Point rhs) { |
60 return lhs.Subtract(rhs); | 68 return lhs.Subtract(rhs); |
61 } | 69 } |
62 | 70 |
63 #if !defined(COMPILER_MSVC) | 71 #if !defined(COMPILER_MSVC) |
64 extern template class PointBase<Point, int>; | 72 extern template class PointBase<Point, int>; |
65 #endif | 73 #endif |
66 | 74 |
67 } // namespace gfx | 75 } // namespace gfx |
68 | 76 |
69 #endif // UI_GFX_POINT_H_ | 77 #endif // UI_GFX_POINT_H_ |
OLD | NEW |