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

Side by Side Diff: base/gfx/point.cc

Issue 195035: Use MAKEPOINTS instead of GET_X/Y_LPARAM to reduce a dependency on ATL.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/gfx/point.h ('k') | chrome/browser/views/keyword_editor_view.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/gfx/point.h" 5 #include "base/gfx/point.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
11 #include <iostream> 11 #include <iostream>
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 Point::Point() : x_(0), y_(0) { 15 Point::Point() : x_(0), y_(0) {
16 } 16 }
17 17
18 Point::Point(int x, int y) : x_(x), y_(y) { 18 Point::Point(int x, int y) : x_(x), y_(y) {
19 } 19 }
20 20
21 #if defined(OS_WIN) 21 #if defined(OS_WIN)
22 Point::Point(DWORD point) {
23 POINTS points = MAKEPOINTS(point);
24 x_ = points.x;
25 y_ = points.y;
26 }
27
22 Point::Point(const POINT& point) : x_(point.x), y_(point.y) { 28 Point::Point(const POINT& point) : x_(point.x), y_(point.y) {
23 } 29 }
24 30
25 Point& Point::operator=(const POINT& point) { 31 Point& Point::operator=(const POINT& point) {
26 x_ = point.x; 32 x_ = point.x;
27 y_ = point.y; 33 y_ = point.y;
28 return *this; 34 return *this;
29 } 35 }
30 36
31 POINT Point::ToPOINT() const { 37 POINT Point::ToPOINT() const {
32 POINT p; 38 POINT p;
33 p.x = x_; 39 p.x = x_;
34 p.y = y_; 40 p.y = y_;
35 return p; 41 return p;
36 } 42 }
37 #elif defined(OS_MACOSX) 43 #elif defined(OS_MACOSX)
38 Point::Point(const CGPoint& point) : x_(point.x), y_(point.y) { 44 Point::Point(const CGPoint& point) : x_(point.x), y_(point.y) {
39 } 45 }
40 46
41 CGPoint Point::ToCGPoint() const { 47 CGPoint Point::ToCGPoint() const {
42 return CGPointMake(x_, y_); 48 return CGPointMake(x_, y_);
43 } 49 }
44 #endif 50 #endif
45 51
46 } // namespace gfx 52 } // namespace gfx
47 53
48 std::ostream& operator<<(std::ostream& out, const gfx::Point& p) { 54 std::ostream& operator<<(std::ostream& out, const gfx::Point& p) {
49 return out << p.x() << "," << p.y(); 55 return out << p.x() << "," << p.y();
50 } 56 }
OLDNEW
« no previous file with comments | « base/gfx/point.h ('k') | chrome/browser/views/keyword_editor_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698