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

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

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/frame_time.h ('k') | ui/gfx/geometry/point.cc » ('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 #ifndef UI_GFX_GEOMETRY_POINT_H_ 5 #ifndef UI_GFX_GEOMETRY_POINT_H_
6 #define UI_GFX_GEOMETRY_POINT_H_ 6 #define UI_GFX_GEOMETRY_POINT_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 10
11 #include "ui/gfx/geometry/point_f.h" 11 #include "ui/gfx/geometry/point_f.h"
12 #include "ui/gfx/geometry/vector2d.h" 12 #include "ui/gfx/geometry/vector2d.h"
13 #include "ui/gfx/gfx_export.h" 13 #include "ui/gfx/gfx_export.h"
14 14
15 #if defined(OS_WIN)
16 typedef unsigned long DWORD;
17 typedef struct tagPOINT POINT;
18 #elif defined(OS_IOS)
19 #include <CoreGraphics/CoreGraphics.h>
20 #elif defined(OS_MACOSX)
21 #include <ApplicationServices/ApplicationServices.h>
22 #endif
23
24 namespace gfx { 15 namespace gfx {
25 16
26 // A point has an x and y coordinate. 17 // A point has an x and y coordinate.
27 class GFX_EXPORT Point { 18 class GFX_EXPORT Point {
28 public: 19 public:
29 Point() : x_(0), y_(0) {} 20 Point() : x_(0), y_(0) {}
30 Point(int x, int y) : x_(x), y_(y) {} 21 Point(int x, int y) : x_(x), y_(y) {}
31 #if defined(OS_WIN)
32 // |point| is a DWORD value that contains a coordinate. The x-coordinate is
33 // the low-order short and the y-coordinate is the high-order short. This
34 // value is commonly acquired from GetMessagePos/GetCursorPos.
35 explicit Point(DWORD point);
36 explicit Point(const POINT& point);
37 Point& operator=(const POINT& point);
38 #elif defined(OS_MACOSX)
39 explicit Point(const CGPoint& point) : x_(point.x), y_(point.y) {}
40 #endif
41 22
42 ~Point() {} 23 ~Point() {}
43 24
44 #if defined(OS_WIN)
45 POINT ToPOINT() const;
46 #elif defined(OS_MACOSX)
47 CGPoint ToCGPoint() const { return CGPointMake(x(), y()); }
48 #endif
49
50 int x() const { return x_; } 25 int x() const { return x_; }
51 int y() const { return y_; } 26 int y() const { return y_; }
52 void set_x(int x) { x_ = x; } 27 void set_x(int x) { x_ = x; }
53 void set_y(int y) { y_ = y; } 28 void set_y(int y) { y_ = y; }
54 29
55 void SetPoint(int x, int y) { 30 void SetPoint(int x, int y) {
56 x_ = x; 31 x_ = x;
57 y_ = y; 32 y_ = y;
58 } 33 }
59 34
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 105 }
131 106
132 // This is declared here for use in gtest-based unit tests but is defined in 107 // This is declared here for use in gtest-based unit tests but is defined in
133 // the gfx_test_support target. Depend on that to use this in your unit test. 108 // the gfx_test_support target. Depend on that to use this in your unit test.
134 // This should not be used in production code - call ToString() instead. 109 // This should not be used in production code - call ToString() instead.
135 void PrintTo(const Point& point, ::std::ostream* os); 110 void PrintTo(const Point& point, ::std::ostream* os);
136 111
137 } // namespace gfx 112 } // namespace gfx
138 113
139 #endif // UI_GFX_GEOMETRY_POINT_H_ 114 #endif // UI_GFX_GEOMETRY_POINT_H_
OLDNEW
« no previous file with comments | « ui/gfx/frame_time.h ('k') | ui/gfx/geometry/point.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698