Chromium Code Reviews| 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 | 11 |
| 11 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 12 typedef unsigned long DWORD; | 13 typedef unsigned long DWORD; |
| 13 typedef struct tagPOINT POINT; | 14 typedef struct tagPOINT POINT; |
| 14 #elif defined(OS_IOS) | 15 #elif defined(OS_IOS) |
| 15 #include <CoreGraphics/CoreGraphics.h> | 16 #include <CoreGraphics/CoreGraphics.h> |
| 16 #elif defined(OS_MACOSX) | 17 #elif defined(OS_MACOSX) |
| 17 #include <ApplicationServices/ApplicationServices.h> | 18 #include <ApplicationServices/ApplicationServices.h> |
| 18 #endif | 19 #endif |
| 19 | 20 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 38 ~Point() {} | 39 ~Point() {} |
| 39 | 40 |
| 40 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 41 POINT ToPOINT() const; | 42 POINT ToPOINT() const; |
| 42 #elif defined(OS_MACOSX) | 43 #elif defined(OS_MACOSX) |
| 43 CGPoint ToCGPoint() const; | 44 CGPoint ToCGPoint() const; |
| 44 #endif | 45 #endif |
| 45 | 46 |
| 46 // Returns a string representation of point. | 47 // Returns a string representation of point. |
| 47 std::string ToString() const; | 48 std::string ToString() const; |
| 49 | |
| 50 operator PointF() const { | |
| 51 return PointF(x(), y()); | |
| 52 } | |
| 48 }; | 53 }; |
| 49 | 54 |
| 55 inline Point operator+(Point lhs, Point rhs) { | |
|
sky
2012/10/01 21:02:20
const Point& here (and 59).
danakj
2012/10/01 22:03:37
Done.
| |
| 56 return lhs.Add(rhs); | |
| 57 } | |
| 58 | |
| 59 inline Point operator-(Point lhs, Point rhs) { | |
| 60 return lhs.Subtract(rhs); | |
| 61 } | |
| 62 | |
| 50 #if !defined(COMPILER_MSVC) | 63 #if !defined(COMPILER_MSVC) |
| 51 extern template class PointBase<Point, int>; | 64 extern template class PointBase<Point, int>; |
| 52 #endif | 65 #endif |
| 53 | 66 |
| 54 } // namespace gfx | 67 } // namespace gfx |
| 55 | 68 |
| 56 #endif // UI_GFX_POINT_H_ | 69 #endif // UI_GFX_POINT_H_ |
| OLD | NEW |