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

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: remove some patch noise 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.cc » ('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..9e4074093b32e1d198b4ca8d16b18df82d70ba2a 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;
@@ -24,6 +25,7 @@ class UI_EXPORT Point : public PointBase<Point, int> {
public:
Point();
Point(int x, int y);
+ Point(const Point& other);
sky 2012/09/28 23:05:49 explicit
danakj 2012/09/28 23:19:14 thanks. i was able to remove the copy constructors
#if defined(OS_WIN)
// |point| is a DWORD value that contains a coordinate. The x-coordinate is
// the low-order short and the y-coordinate is the high-order short. This
@@ -45,8 +47,20 @@ class UI_EXPORT Point : public PointBase<Point, int> {
// Returns a string representation of point.
std::string ToString() const;
+
+ operator PointF() const WARN_UNUSED_RESULT {
sky 2012/09/28 23:05:49 Why the WARN_UNUSED_RESULT?
danakj 2012/09/28 23:19:14 removed.
+ return PointF(x(), y());
+ }
};
+inline Point operator+(Point lhs, Point rhs) {
+ 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.cc » ('j') | ui/gfx/point_f.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698