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

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

Issue 10993094: Make adding and subtracting gfx:: point types simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/backing_store_mac.mm ('k') | ui/gfx/point_f.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 #ifndef UI_GFX_POINT_H_ 5 #ifndef UI_GFX_POINT_H_
6 #define UI_GFX_POINT_H_ 6 #define UI_GFX_POINT_H_
7 7
8 #include "ui/base/ui_export.h" 8 #include "ui/base/ui_export.h"
9 #include "ui/gfx/point_base.h" 9 #include "ui/gfx/point_base.h"
10 #include "ui/gfx/point_f.h"
10 11
11 #if defined(OS_WIN) 12 #if defined(OS_WIN)
12 typedef unsigned long DWORD; 13 typedef unsigned long DWORD;
13 typedef struct tagPOINT POINT; 14 typedef struct tagPOINT POINT;
14 #elif defined(OS_IOS) 15 #elif defined(OS_IOS)
15 #include <CoreGraphics/CoreGraphics.h> 16 #include <CoreGraphics/CoreGraphics.h>
16 #elif defined(OS_MACOSX) 17 #elif defined(OS_MACOSX)
17 #include <ApplicationServices/ApplicationServices.h> 18 #include <ApplicationServices/ApplicationServices.h>
18 #endif 19 #endif
19 20
(...skipping 16 matching lines...) Expand all
36 #endif 37 #endif
37 38
38 ~Point() {} 39 ~Point() {}
39 40
40 #if defined(OS_WIN) 41 #if defined(OS_WIN)
41 POINT ToPOINT() const; 42 POINT ToPOINT() const;
42 #elif defined(OS_MACOSX) 43 #elif defined(OS_MACOSX)
43 CGPoint ToCGPoint() const; 44 CGPoint ToCGPoint() const;
44 #endif 45 #endif
45 46
47 PointF ToPointF() const {
48 return PointF(x(), y());
49 }
50
46 // Returns a string representation of point. 51 // Returns a string representation of point.
47 std::string ToString() const; 52 std::string ToString() const;
48 }; 53 };
49 54
55 inline Point operator+(Point lhs, Point rhs) {
56 return lhs.Add(rhs);
57 }
58
59 inline Point operator-(Point lhs, Point rhs) {
60 return lhs.Subtract(rhs);
61 }
62
50 #if !defined(COMPILER_MSVC) 63 #if !defined(COMPILER_MSVC)
51 extern template class PointBase<Point, int>; 64 extern template class PointBase<Point, int>;
52 #endif 65 #endif
53 66
54 } // namespace gfx 67 } // namespace gfx
55 68
56 #endif // UI_GFX_POINT_H_ 69 #endif // UI_GFX_POINT_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/backing_store_mac.mm ('k') | ui/gfx/point_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698