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

Unified Diff: ui/gfx/geometry/point.cc

Issue 642343003: gfx: De-templatize the gfx::Point and gfx::PointF classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: inlines-point: rebase Created 6 years, 2 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 | « ui/gfx/geometry/point.h ('k') | ui/gfx/geometry/point_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/geometry/point.cc
diff --git a/ui/gfx/geometry/point.cc b/ui/gfx/geometry/point.cc
index 5a68ba67bdd8fe108105905a0f16c7e3e7a8f1ea..2248a4dbe7e654dd109b6e2b4ccf829beba88457 100644
--- a/ui/gfx/geometry/point.cc
+++ b/ui/gfx/geometry/point.cc
@@ -12,22 +12,19 @@
namespace gfx {
-template class PointBase<Point, int, Vector2d>;
-
#if defined(OS_WIN)
-Point::Point(DWORD point) : PointBase<Point, int, Vector2d>(0, 0){
+Point::Point(DWORD point) {
POINTS points = MAKEPOINTS(point);
- set_x(points.x);
- set_y(points.y);
+ x_ = points.x;
+ y_ = points.y;
}
-Point::Point(const POINT& point)
- : PointBase<Point, int, Vector2d>(point.x, point.y) {
+Point::Point(const POINT& point) : x_(point.x), y_(point.y) {
}
Point& Point::operator=(const POINT& point) {
- set_x(point.x);
- set_y(point.y);
+ x_ = point.x;
+ y_ = point.y;
return *this;
}
@@ -37,15 +34,17 @@ POINT Point::ToPOINT() const {
p.y = y();
return p;
}
-#elif defined(OS_MACOSX)
-Point::Point(const CGPoint& point)
- : PointBase<Point, int, Vector2d>(point.x, point.y) {
+#endif
+
+void Point::SetToMin(const Point& other) {
+ x_ = x_ <= other.x_ ? x_ : other.x_;
+ y_ = y_ <= other.y_ ? y_ : other.y_;
}
-CGPoint Point::ToCGPoint() const {
- return CGPointMake(x(), y());
+void Point::SetToMax(const Point& other) {
+ x_ = x_ >= other.x_ ? x_ : other.x_;
+ y_ = y_ >= other.y_ ? y_ : other.y_;
}
-#endif
std::string Point::ToString() const {
return base::StringPrintf("%d,%d", x(), y());
« no previous file with comments | « ui/gfx/geometry/point.h ('k') | ui/gfx/geometry/point_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698