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> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "ui/gfx/geometry/box_f.h" | 15 #include "ui/gfx/geometry/box_f.h" |
16 #include "ui/gfx/geometry/point3_f.h" | 16 #include "ui/gfx/geometry/point3_f.h" |
17 #include "ui/gfx/geometry/point_f.h" | 17 #include "ui/gfx/geometry/point_f.h" |
18 #include "ui/gfx/geometry/scroll_offset.h" | 18 #include "ui/gfx/geometry/scroll_offset.h" |
19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
20 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class Value; | 23 class Value; |
24 namespace trace_event { | 24 namespace trace_event { |
25 class TracedValue; | 25 class TracedValue; |
26 } | 26 } |
27 | |
28 // TODO(ssid): remove these aliases after the tracing clients are moved to the | |
29 // new trace_event namespace. See crbug.com/451032. ETA: March 2015. | |
30 namespace debug { | |
31 using ::base::trace_event::TracedValue; | |
32 } | |
33 } // namespace base | 27 } // namespace base |
34 | 28 |
35 namespace gfx { | 29 namespace gfx { |
36 class QuadF; | 30 class QuadF; |
37 class Rect; | 31 class Rect; |
38 class RectF; | 32 class RectF; |
39 class Transform; | 33 class Transform; |
40 class Vector2dF; | 34 class Vector2dF; |
41 class Vector2d; | 35 class Vector2d; |
42 } | 36 } |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 const gfx::Vector2dF& destination); | 194 const gfx::Vector2dF& destination); |
201 | 195 |
202 // Conversion to value. | 196 // Conversion to value. |
203 static scoped_ptr<base::Value> AsValue(const gfx::Size& s); | 197 static scoped_ptr<base::Value> AsValue(const gfx::Size& s); |
204 static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); | 198 static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); |
205 static bool FromValue(const base::Value*, gfx::Rect* out_rect); | 199 static bool FromValue(const base::Value*, gfx::Rect* out_rect); |
206 static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); | 200 static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); |
207 | 201 |
208 static void AddToTracedValue(const char* name, | 202 static void AddToTracedValue(const char* name, |
209 const gfx::Size& s, | 203 const gfx::Size& s, |
210 base::debug::TracedValue* res); | 204 base::trace_event::TracedValue* res); |
211 static void AddToTracedValue(const char* name, | 205 static void AddToTracedValue(const char* name, |
212 const gfx::SizeF& s, | 206 const gfx::SizeF& s, |
213 base::debug::TracedValue* res); | 207 base::trace_event::TracedValue* res); |
214 static void AddToTracedValue(const char* name, | 208 static void AddToTracedValue(const char* name, |
215 const gfx::Rect& r, | 209 const gfx::Rect& r, |
216 base::debug::TracedValue* res); | 210 base::trace_event::TracedValue* res); |
217 static void AddToTracedValue(const char* name, | 211 static void AddToTracedValue(const char* name, |
218 const gfx::PointF& q, | 212 const gfx::PointF& q, |
219 base::debug::TracedValue* res); | 213 base::trace_event::TracedValue* res); |
220 static void AddToTracedValue(const char* name, | 214 static void AddToTracedValue(const char* name, |
221 const gfx::Point3F&, | 215 const gfx::Point3F&, |
222 base::debug::TracedValue* res); | 216 base::trace_event::TracedValue* res); |
223 static void AddToTracedValue(const char* name, | 217 static void AddToTracedValue(const char* name, |
224 const gfx::Vector2d& v, | 218 const gfx::Vector2d& v, |
225 base::debug::TracedValue* res); | 219 base::trace_event::TracedValue* res); |
226 static void AddToTracedValue(const char* name, | 220 static void AddToTracedValue(const char* name, |
227 const gfx::Vector2dF& v, | 221 const gfx::Vector2dF& v, |
228 base::debug::TracedValue* res); | 222 base::trace_event::TracedValue* res); |
229 static void AddToTracedValue(const char* name, | 223 static void AddToTracedValue(const char* name, |
230 const gfx::ScrollOffset& v, | 224 const gfx::ScrollOffset& v, |
231 base::debug::TracedValue* res); | 225 base::trace_event::TracedValue* res); |
232 static void AddToTracedValue(const char* name, | 226 static void AddToTracedValue(const char* name, |
233 const gfx::QuadF& q, | 227 const gfx::QuadF& q, |
234 base::debug::TracedValue* res); | 228 base::trace_event::TracedValue* res); |
235 static void AddToTracedValue(const char* name, | 229 static void AddToTracedValue(const char* name, |
236 const gfx::RectF& rect, | 230 const gfx::RectF& rect, |
237 base::debug::TracedValue* res); | 231 base::trace_event::TracedValue* res); |
238 static void AddToTracedValue(const char* name, | 232 static void AddToTracedValue(const char* name, |
239 const gfx::Transform& transform, | 233 const gfx::Transform& transform, |
240 base::debug::TracedValue* res); | 234 base::trace_event::TracedValue* res); |
241 static void AddToTracedValue(const char* name, | 235 static void AddToTracedValue(const char* name, |
242 const gfx::BoxF& box, | 236 const gfx::BoxF& box, |
243 base::debug::TracedValue* res); | 237 base::trace_event::TracedValue* res); |
244 | 238 |
245 // Returns a base::Value representation of the floating point value. | 239 // Returns a base::Value representation of the floating point value. |
246 // If the value is inf, returns max double/float representation. | 240 // If the value is inf, returns max double/float representation. |
247 static double AsDoubleSafely(double value); | 241 static double AsDoubleSafely(double value); |
248 static float AsFloatSafely(float value); | 242 static float AsFloatSafely(float value); |
249 }; | 243 }; |
250 | 244 |
251 } // namespace cc | 245 } // namespace cc |
252 | 246 |
253 #endif // CC_BASE_MATH_UTIL_H_ | 247 #endif // CC_BASE_MATH_UTIL_H_ |
OLD | NEW |