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

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

Issue 11293194: ui: Prefer +/- operators to apply offsets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: floats Created 8 years, 1 month 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
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 #include "ui/gfx/point_f.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return result; 67 return result;
68 } 68 }
69 69
70 inline Point operator-(const Point& lhs, const Vector2d& rhs) { 70 inline Point operator-(const Point& lhs, const Vector2d& rhs) {
71 Point result(lhs); 71 Point result(lhs);
72 result -= rhs; 72 result -= rhs;
73 return result; 73 return result;
74 } 74 }
75 75
76 inline Vector2d operator-(const Point& lhs, const Point& rhs) { 76 inline Vector2d operator-(const Point& lhs, const Point& rhs) {
77 return lhs.OffsetFrom(rhs); 77 return Vector2d(lhs.x() - rhs.x(), lhs.y() - rhs.y());
78 } 78 }
79 79
80 inline Point PointAtOffsetFromOrigin(const Vector2d& offset_from_origin) { 80 inline Point PointAtOffsetFromOrigin(const Vector2d& offset_from_origin) {
81 return Point(offset_from_origin.x(), offset_from_origin.y()); 81 return Point(offset_from_origin.x(), offset_from_origin.y());
82 } 82 }
83 83
84 #if !defined(COMPILER_MSVC) 84 #if !defined(COMPILER_MSVC)
85 extern template class PointBase<Point, int, Vector2d>; 85 extern template class PointBase<Point, int, Vector2d>;
86 #endif 86 #endif
87 87
88 } // namespace gfx 88 } // namespace gfx
89 89
90 #endif // UI_GFX_POINT_H_ 90 #endif // UI_GFX_POINT_H_
OLDNEW
« .gitmodules ('K') | « ui/gfx/pango_util.cc ('k') | ui/gfx/point_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698