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

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

Issue 23498059: Remove last dependencies on ui/base from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: last rebase Created 7 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 | « ui/gfx/vector2d_conversions.h ('k') | ui/gfx/vector3d_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 // Defines a simple float vector class. This class is used to indicate a 5 // Defines a simple float vector class. This class is used to indicate a
6 // distance in two dimensions between two points. Subtracting two points should 6 // distance in two dimensions between two points. Subtracting two points should
7 // produce a vector, and adding a vector to a point produces the point at the 7 // produce a vector, and adding a vector to a point produces the point at the
8 // vector's distance from the original point. 8 // vector's distance from the original point.
9 9
10 #ifndef UI_GFX_VECTOR2D_F_H_ 10 #ifndef UI_GFX_VECTOR2D_F_H_
11 #define UI_GFX_VECTOR2D_F_H_ 11 #define UI_GFX_VECTOR2D_F_H_
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "ui/gfx/gfx_export.h" 15 #include "ui/gfx/gfx_export.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 18
19 class UI_EXPORT Vector2dF { 19 class GFX_EXPORT Vector2dF {
20 public: 20 public:
21 Vector2dF() : x_(0), y_(0) {} 21 Vector2dF() : x_(0), y_(0) {}
22 Vector2dF(float x, float y) : x_(x), y_(y) {} 22 Vector2dF(float x, float y) : x_(x), y_(y) {}
23 23
24 float x() const { return x_; } 24 float x() const { return x_; }
25 void set_x(float x) { x_ = x; } 25 void set_x(float x) { x_ = x; }
26 26
27 float y() const { return y_; } 27 float y() const { return y_; }
28 void set_y(float y) { y_ = y; } 28 void set_y(float y) { y_ = y; }
29 29
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return result; 84 return result;
85 } 85 }
86 86
87 inline Vector2dF operator-(const Vector2dF& lhs, const Vector2dF& rhs) { 87 inline Vector2dF operator-(const Vector2dF& lhs, const Vector2dF& rhs) {
88 Vector2dF result = lhs; 88 Vector2dF result = lhs;
89 result.Add(-rhs); 89 result.Add(-rhs);
90 return result; 90 return result;
91 } 91 }
92 92
93 // Return the cross product of two vectors. 93 // Return the cross product of two vectors.
94 UI_EXPORT double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs); 94 GFX_EXPORT double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs);
95 95
96 // Return the dot product of two vectors. 96 // Return the dot product of two vectors.
97 UI_EXPORT double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs); 97 GFX_EXPORT double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs);
98 98
99 // Return a vector that is |v| scaled by the given scale factors along each 99 // Return a vector that is |v| scaled by the given scale factors along each
100 // axis. 100 // axis.
101 UI_EXPORT Vector2dF ScaleVector2d(const Vector2dF& v, 101 GFX_EXPORT Vector2dF ScaleVector2d(const Vector2dF& v,
102 float x_scale, 102 float x_scale,
103 float y_scale); 103 float y_scale);
104 104
105 // Return a vector that is |v| scaled by the given scale factor. 105 // Return a vector that is |v| scaled by the given scale factor.
106 inline Vector2dF ScaleVector2d(const Vector2dF& v, float scale) { 106 inline Vector2dF ScaleVector2d(const Vector2dF& v, float scale) {
107 return ScaleVector2d(v, scale, scale); 107 return ScaleVector2d(v, scale, scale);
108 } 108 }
109 109
110 } // namespace gfx 110 } // namespace gfx
111 111
112 #endif // UI_GFX_VECTOR2D_F_H_ 112 #endif // UI_GFX_VECTOR2D_F_H_
OLDNEW
« no previous file with comments | « ui/gfx/vector2d_conversions.h ('k') | ui/gfx/vector3d_f.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698