OLD | NEW |
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 #include <vector> | 10 #include <vector> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // to be normalized. | 192 // to be normalized. |
193 static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source, | 193 static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source, |
194 const gfx::Vector2dF& destination); | 194 const gfx::Vector2dF& destination); |
195 | 195 |
196 // Conversion to value. | 196 // Conversion to value. |
197 static scoped_ptr<base::Value> AsValue(const gfx::Size& s); | 197 static scoped_ptr<base::Value> AsValue(const gfx::Size& s); |
198 static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); | 198 static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); |
199 static bool FromValue(const base::Value*, gfx::Rect* out_rect); | 199 static bool FromValue(const base::Value*, gfx::Rect* out_rect); |
200 static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); | 200 static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); |
201 | 201 |
202 static void AddToTracedValue(const gfx::Size& s, | 202 static void AddToTracedValue(const char* name, |
| 203 const gfx::Size& s, |
203 base::debug::TracedValue* res); | 204 base::debug::TracedValue* res); |
204 static void AddToTracedValue(const gfx::SizeF& s, | 205 static void AddToTracedValue(const char* name, |
| 206 const gfx::SizeF& s, |
205 base::debug::TracedValue* res); | 207 base::debug::TracedValue* res); |
206 static void AddToTracedValue(const gfx::Rect& r, | 208 static void AddToTracedValue(const char* name, |
| 209 const gfx::Rect& r, |
207 base::debug::TracedValue* res); | 210 base::debug::TracedValue* res); |
208 static void AddToTracedValue(const gfx::PointF& q, | 211 static void AddToTracedValue(const char* name, |
| 212 const gfx::PointF& q, |
209 base::debug::TracedValue* res); | 213 base::debug::TracedValue* res); |
210 static void AddToTracedValue(const gfx::Point3F&, | 214 static void AddToTracedValue(const char* name, |
| 215 const gfx::Point3F&, |
211 base::debug::TracedValue* res); | 216 base::debug::TracedValue* res); |
212 static void AddToTracedValue(const gfx::Vector2d& v, | 217 static void AddToTracedValue(const char* name, |
| 218 const gfx::Vector2d& v, |
213 base::debug::TracedValue* res); | 219 base::debug::TracedValue* res); |
214 static void AddToTracedValue(const gfx::Vector2dF& v, | 220 static void AddToTracedValue(const char* name, |
| 221 const gfx::Vector2dF& v, |
215 base::debug::TracedValue* res); | 222 base::debug::TracedValue* res); |
216 static void AddToTracedValue(const gfx::ScrollOffset& v, | 223 static void AddToTracedValue(const char* name, |
| 224 const gfx::ScrollOffset& v, |
217 base::debug::TracedValue* res); | 225 base::debug::TracedValue* res); |
218 static void AddToTracedValue(const gfx::QuadF& q, | 226 static void AddToTracedValue(const char* name, |
| 227 const gfx::QuadF& q, |
219 base::debug::TracedValue* res); | 228 base::debug::TracedValue* res); |
220 static void AddToTracedValue(const gfx::RectF& rect, | 229 static void AddToTracedValue(const char* name, |
| 230 const gfx::RectF& rect, |
221 base::debug::TracedValue* res); | 231 base::debug::TracedValue* res); |
222 static void AddToTracedValue(const gfx::Transform& transform, | 232 static void AddToTracedValue(const char* name, |
| 233 const gfx::Transform& transform, |
223 base::debug::TracedValue* res); | 234 base::debug::TracedValue* res); |
224 static void AddToTracedValue(const gfx::BoxF& box, | 235 static void AddToTracedValue(const char* name, |
| 236 const gfx::BoxF& box, |
225 base::debug::TracedValue* res); | 237 base::debug::TracedValue* res); |
226 | 238 |
227 // Returns a base::Value representation of the floating point value. | 239 // Returns a base::Value representation of the floating point value. |
228 // If the value is inf, returns max double/float representation. | 240 // If the value is inf, returns max double/float representation. |
229 static double AsDoubleSafely(double value); | 241 static double AsDoubleSafely(double value); |
230 static float AsFloatSafely(float value); | 242 static float AsFloatSafely(float value); |
231 }; | 243 }; |
232 | 244 |
233 } // namespace cc | 245 } // namespace cc |
234 | 246 |
235 #endif // CC_BASE_MATH_UTIL_H_ | 247 #endif // CC_BASE_MATH_UTIL_H_ |
OLD | NEW |