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

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

Issue 1092033006: [Mac/Cleanup] Trim down Foundation.h and ApplicationServices.h includes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include -> import Created 5 years, 7 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) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #elif defined(OS_IOS)
10 #include <CoreGraphics/CoreGraphics.h>
11 #elif defined(OS_MACOSX)
12 #include <ApplicationServices/ApplicationServices.h>
9 #endif 13 #endif
10 14
11 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
12 16
13 namespace gfx { 17 namespace gfx {
14 18
15 #if defined(OS_WIN) 19 #if defined(OS_WIN)
16 Point::Point(DWORD point) { 20 Point::Point(DWORD point) {
17 POINTS points = MAKEPOINTS(point); 21 POINTS points = MAKEPOINTS(point);
18 x_ = points.x; 22 x_ = points.x;
19 y_ = points.y; 23 y_ = points.y;
20 } 24 }
21 25
22 Point::Point(const POINT& point) : x_(point.x), y_(point.y) { 26 Point::Point(const POINT& point) : x_(point.x), y_(point.y) {
23 } 27 }
24 28
25 Point& Point::operator=(const POINT& point) { 29 Point& Point::operator=(const POINT& point) {
26 x_ = point.x; 30 x_ = point.x;
27 y_ = point.y; 31 y_ = point.y;
28 return *this; 32 return *this;
29 } 33 }
34 #elif defined(OS_MACOSX)
35 Point::Point(const CGPoint& point) : x_(point.x), y_(point.y) {
36 }
37 #endif
30 38
39 #if defined(OS_WIN)
31 POINT Point::ToPOINT() const { 40 POINT Point::ToPOINT() const {
32 POINT p; 41 POINT p;
33 p.x = x(); 42 p.x = x();
34 p.y = y(); 43 p.y = y();
35 return p; 44 return p;
36 } 45 }
46 #elif defined(OS_MACOSX)
47 CGPoint Point::ToCGPoint() const {
48 return CGPointMake(x(), y());
49 }
37 #endif 50 #endif
38 51
39 void Point::SetToMin(const Point& other) { 52 void Point::SetToMin(const Point& other) {
40 x_ = x_ <= other.x_ ? x_ : other.x_; 53 x_ = x_ <= other.x_ ? x_ : other.x_;
41 y_ = y_ <= other.y_ ? y_ : other.y_; 54 y_ = y_ <= other.y_ ? y_ : other.y_;
42 } 55 }
43 56
44 void Point::SetToMax(const Point& other) { 57 void Point::SetToMax(const Point& other) {
45 x_ = x_ >= other.x_ ? x_ : other.x_; 58 x_ = x_ >= other.x_ ? x_ : other.x_;
46 y_ = y_ >= other.y_ ? y_ : other.y_; 59 y_ = y_ >= other.y_ ? y_ : other.y_;
47 } 60 }
48 61
49 std::string Point::ToString() const { 62 std::string Point::ToString() const {
50 return base::StringPrintf("%d,%d", x(), y()); 63 return base::StringPrintf("%d,%d", x(), y());
51 } 64 }
52 65
53 } // namespace gfx 66 } // 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