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

Side by Side Diff: ui/gfx/point_f.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_F_H_ 5 #ifndef UI_GFX_POINT_F_H_
6 #define UI_GFX_POINT_F_H_ 6 #define UI_GFX_POINT_F_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ui/base/ui_export.h" 10 #include "ui/base/ui_export.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return result; 46 return result;
47 } 47 }
48 48
49 inline PointF operator-(const PointF& lhs, const Vector2dF& rhs) { 49 inline PointF operator-(const PointF& lhs, const Vector2dF& rhs) {
50 PointF result(lhs); 50 PointF result(lhs);
51 result -= rhs; 51 result -= rhs;
52 return result; 52 return result;
53 } 53 }
54 54
55 inline Vector2dF operator-(const PointF& lhs, const PointF& rhs) { 55 inline Vector2dF operator-(const PointF& lhs, const PointF& rhs) {
56 return lhs.OffsetFrom(rhs); 56 return Vector2dF(lhs.x() - rhs.x(), lhs.y() - rhs.y());
57 } 57 }
58 58
59 inline PointF PointAtOffsetFromOrigin(const Vector2dF& offset_from_origin) { 59 inline PointF PointAtOffsetFromOrigin(const Vector2dF& offset_from_origin) {
60 return PointF(offset_from_origin.x(), offset_from_origin.y()); 60 return PointF(offset_from_origin.x(), offset_from_origin.y());
61 } 61 }
62 62
63 UI_EXPORT PointF ScalePoint(const PointF& p, float x_scale, float y_scale); 63 UI_EXPORT PointF ScalePoint(const PointF& p, float x_scale, float y_scale);
64 64
65 inline PointF ScalePoint(const PointF& p, float scale) { 65 inline PointF ScalePoint(const PointF& p, float scale) {
66 return ScalePoint(p, scale, scale); 66 return ScalePoint(p, scale, scale);
67 } 67 }
68 68
69 #if !defined(COMPILER_MSVC) 69 #if !defined(COMPILER_MSVC)
70 extern template class PointBase<PointF, float, Vector2dF>; 70 extern template class PointBase<PointF, float, Vector2dF>;
71 #endif 71 #endif
72 72
73 } // namespace gfx 73 } // namespace gfx
74 74
75 #endif // UI_GFX_POINT_F_H_ 75 #endif // UI_GFX_POINT_F_H_
OLDNEW
« .gitmodules ('K') | « ui/gfx/point_base.h ('k') | ui/gfx/point_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698