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

Side by Side Diff: cc/base/math_util.h

Issue 145313006: [#7] Pass gfx structs by const ref (gfx::Size) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 10 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
« no previous file with comments | « no previous file | cc/base/math_util.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_BASE_MATH_UTIL_H_ 5 #ifndef CC_BASE_MATH_UTIL_H_
6 #define CC_BASE_MATH_UTIL_H_ 6 #define CC_BASE_MATH_UTIL_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Neither vector is assumed to be normalized. 158 // Neither vector is assumed to be normalized.
159 static float SmallestAngleBetweenVectors(const gfx::Vector2dF& v1, 159 static float SmallestAngleBetweenVectors(const gfx::Vector2dF& v1,
160 const gfx::Vector2dF& v2); 160 const gfx::Vector2dF& v2);
161 161
162 // Projects the |source| vector onto |destination|. Neither vector is assumed 162 // Projects the |source| vector onto |destination|. Neither vector is assumed
163 // to be normalized. 163 // to be normalized.
164 static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source, 164 static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source,
165 const gfx::Vector2dF& destination); 165 const gfx::Vector2dF& destination);
166 166
167 // Conversion to value. 167 // Conversion to value.
168 static scoped_ptr<base::Value> AsValue(gfx::Size s); 168 static scoped_ptr<base::Value> AsValue(const gfx::Size& s);
169 static scoped_ptr<base::Value> AsValue(const gfx::SizeF& s); 169 static scoped_ptr<base::Value> AsValue(const gfx::SizeF& s);
170 static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); 170 static scoped_ptr<base::Value> AsValue(const gfx::Rect& r);
171 static bool FromValue(const base::Value*, gfx::Rect* out_rect); 171 static bool FromValue(const base::Value*, gfx::Rect* out_rect);
172 static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); 172 static scoped_ptr<base::Value> AsValue(const gfx::PointF& q);
173 static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q); 173 static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q);
174 static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect); 174 static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect);
175 static scoped_ptr<base::Value> AsValue(const gfx::Transform& transform); 175 static scoped_ptr<base::Value> AsValue(const gfx::Transform& transform);
176 static scoped_ptr<base::Value> AsValue(const gfx::BoxF& box); 176 static scoped_ptr<base::Value> AsValue(const gfx::BoxF& box);
177 177
178 // Returns a base::Value representation of the floating point value. 178 // Returns a base::Value representation of the floating point value.
179 // If the value is inf, returns max double/float representation. 179 // If the value is inf, returns max double/float representation.
180 static scoped_ptr<base::Value> AsValueSafely(double value); 180 static scoped_ptr<base::Value> AsValueSafely(double value);
181 static scoped_ptr<base::Value> AsValueSafely(float value); 181 static scoped_ptr<base::Value> AsValueSafely(float value);
182 }; 182 };
183 183
184 } // namespace cc 184 } // namespace cc
185 185
186 #endif // CC_BASE_MATH_UTIL_H_ 186 #endif // CC_BASE_MATH_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | cc/base/math_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698