Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Unified Diff: ui/gfx/point.h

Issue 10993094: Make adding and subtracting gfx:: point types simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/point_f.h » ('j') | ui/gfx/point_f.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/point.h
diff --git a/ui/gfx/point.h b/ui/gfx/point.h
index dfb227d190eb22afb01371d9f2ba35e12969bf27..4cfe466163ea449c43fe196fd5e03b8afb9b9c96 100644
--- a/ui/gfx/point.h
+++ b/ui/gfx/point.h
@@ -7,6 +7,7 @@
#include "ui/base/ui_export.h"
#include "ui/gfx/point_base.h"
+#include "ui/gfx/point_f.h"
#if defined(OS_WIN)
typedef unsigned long DWORD;
@@ -45,8 +46,20 @@ class UI_EXPORT Point : public PointBase<Point, int> {
// Returns a string representation of point.
std::string ToString() const;
+
+ operator PointF() const {
+ return PointF(x(), y());
+ }
};
+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.
+ return lhs.Add(rhs);
+}
+
+inline Point operator-(Point lhs, Point rhs) {
+ return lhs.Subtract(rhs);
+}
+
#if !defined(COMPILER_MSVC)
extern template class PointBase<Point, int>;
#endif
« no previous file with comments | « no previous file | ui/gfx/point_f.h » ('j') | ui/gfx/point_f.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698