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

Side by Side Diff: ui/gfx/geometry/point.cc

Issue 1061733002: Remove windows/mac/ios specific code from //ui (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix default try set Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/geometry/point.h ('k') | ui/gfx/geometry/rect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/gfx/geometry/point.h" 5 #include "ui/gfx/geometry/point.h"
6 6
7 #if defined(OS_WIN)
8 #include <windows.h>
9 #endif
10
11 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
12 8
13 namespace gfx { 9 namespace gfx {
14 10
15 #if defined(OS_WIN)
16 Point::Point(DWORD point) {
17 POINTS points = MAKEPOINTS(point);
18 x_ = points.x;
19 y_ = points.y;
20 }
21
22 Point::Point(const POINT& point) : x_(point.x), y_(point.y) {
23 }
24
25 Point& Point::operator=(const POINT& point) {
26 x_ = point.x;
27 y_ = point.y;
28 return *this;
29 }
30
31 POINT Point::ToPOINT() const {
32 POINT p;
33 p.x = x();
34 p.y = y();
35 return p;
36 }
37 #endif
38
39 void Point::SetToMin(const Point& other) { 11 void Point::SetToMin(const Point& other) {
40 x_ = x_ <= other.x_ ? x_ : other.x_; 12 x_ = x_ <= other.x_ ? x_ : other.x_;
41 y_ = y_ <= other.y_ ? y_ : other.y_; 13 y_ = y_ <= other.y_ ? y_ : other.y_;
42 } 14 }
43 15
44 void Point::SetToMax(const Point& other) { 16 void Point::SetToMax(const Point& other) {
45 x_ = x_ >= other.x_ ? x_ : other.x_; 17 x_ = x_ >= other.x_ ? x_ : other.x_;
46 y_ = y_ >= other.y_ ? y_ : other.y_; 18 y_ = y_ >= other.y_ ? y_ : other.y_;
47 } 19 }
48 20
49 std::string Point::ToString() const { 21 std::string Point::ToString() const {
50 return base::StringPrintf("%d,%d", x(), y()); 22 return base::StringPrintf("%d,%d", x(), y());
51 } 23 }
52 24
53 } // namespace gfx 25 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/point.h ('k') | ui/gfx/geometry/rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698