| 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  |   10  | 
|   11 #include "base/logging.h" |   11 #include "base/logging.h" | 
|   12 #include "base/memory/scoped_ptr.h" |   12 #include "base/memory/scoped_ptr.h" | 
|   13 #include "cc/base/cc_export.h" |   13 #include "cc/base/cc_export.h" | 
|   14 #include "ui/gfx/box_f.h" |   14 #include "ui/gfx/box_f.h" | 
|   15 #include "ui/gfx/point3_f.h" |   15 #include "ui/gfx/point3_f.h" | 
|   16 #include "ui/gfx/point_f.h" |   16 #include "ui/gfx/point_f.h" | 
|   17 #include "ui/gfx/size.h" |   17 #include "ui/gfx/size.h" | 
|   18 #include "ui/gfx/transform.h" |   18 #include "ui/gfx/transform.h" | 
|   19  |   19  | 
|   20 namespace base { |   20 namespace base { class Value; } | 
|   21 class Value; |  | 
|   22 namespace debug { |  | 
|   23 class TracedValue; |  | 
|   24 } |  | 
|   25 } |  | 
|   26  |   21  | 
|   27 namespace gfx { |   22 namespace gfx { | 
|   28 class QuadF; |   23 class QuadF; | 
|   29 class Rect; |   24 class Rect; | 
|   30 class RectF; |   25 class RectF; | 
|   31 class Transform; |   26 class Transform; | 
|   32 class Vector2dF; |   27 class Vector2dF; | 
|   33 class Vector2d; |   28 class Vector2d; | 
|   34 } |   29 } | 
|   35  |   30  | 
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  172   static float SmallestAngleBetweenVectors(const gfx::Vector2dF& v1, |  167   static float SmallestAngleBetweenVectors(const gfx::Vector2dF& v1, | 
|  173                                            const gfx::Vector2dF& v2); |  168                                            const gfx::Vector2dF& v2); | 
|  174  |  169  | 
|  175   // Projects the |source| vector onto |destination|. Neither vector is assumed |  170   // Projects the |source| vector onto |destination|. Neither vector is assumed | 
|  176   // to be normalized. |  171   // to be normalized. | 
|  177   static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source, |  172   static gfx::Vector2dF ProjectVector(const gfx::Vector2dF& source, | 
|  178                                       const gfx::Vector2dF& destination); |  173                                       const gfx::Vector2dF& destination); | 
|  179  |  174  | 
|  180   // Conversion to value. |  175   // Conversion to value. | 
|  181   static scoped_ptr<base::Value> AsValue(const gfx::Size& s); |  176   static scoped_ptr<base::Value> AsValue(const gfx::Size& s); | 
 |  177   static scoped_ptr<base::Value> AsValue(const gfx::SizeF& s); | 
|  182   static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); |  178   static scoped_ptr<base::Value> AsValue(const gfx::Rect& r); | 
|  183   static bool FromValue(const base::Value*, gfx::Rect* out_rect); |  179   static bool FromValue(const base::Value*, gfx::Rect* out_rect); | 
|  184   static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); |  180   static scoped_ptr<base::Value> AsValue(const gfx::PointF& q); | 
|  185  |  181   static scoped_ptr<base::Value> AsValue(const gfx::Point3F&); | 
|  186   static void AddToTracedValue(const gfx::Size& s, |  182   static scoped_ptr<base::Value> AsValue(const gfx::Vector2d& v); | 
|  187                                base::debug::TracedValue* res); |  183   static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q); | 
|  188   static void AddToTracedValue(const gfx::SizeF& s, |  184   static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect); | 
|  189                                base::debug::TracedValue* res); |  185   static scoped_ptr<base::Value> AsValue(const gfx::Transform& transform); | 
|  190   static void AddToTracedValue(const gfx::Rect& r, |  186   static scoped_ptr<base::Value> AsValue(const gfx::BoxF& box); | 
|  191                                base::debug::TracedValue* res); |  | 
|  192   static void AddToTracedValue(const gfx::PointF& q, |  | 
|  193                                base::debug::TracedValue* res); |  | 
|  194   static void AddToTracedValue(const gfx::Point3F&, |  | 
|  195                                base::debug::TracedValue* res); |  | 
|  196   static void AddToTracedValue(const gfx::Vector2d& v, |  | 
|  197                                base::debug::TracedValue* res); |  | 
|  198   static void AddToTracedValue(const gfx::QuadF& q, |  | 
|  199                                base::debug::TracedValue* res); |  | 
|  200   static void AddToTracedValue(const gfx::RectF& rect, |  | 
|  201                                base::debug::TracedValue* res); |  | 
|  202   static void AddToTracedValue(const gfx::Transform& transform, |  | 
|  203                                base::debug::TracedValue* res); |  | 
|  204   static void AddToTracedValue(const gfx::BoxF& box, |  | 
|  205                                base::debug::TracedValue* res); |  | 
|  206  |  187  | 
|  207   // Returns a base::Value representation of the floating point value. |  188   // Returns a base::Value representation of the floating point value. | 
|  208   // If the value is inf, returns max double/float representation. |  189   // If the value is inf, returns max double/float representation. | 
|  209   static double AsDoubleSafely(double value); |  190   static scoped_ptr<base::Value> AsValueSafely(double value); | 
|  210   static float AsFloatSafely(float value); |  191   static scoped_ptr<base::Value> AsValueSafely(float value); | 
|  211 }; |  192 }; | 
|  212  |  193  | 
|  213 }  // namespace cc |  194 }  // namespace cc | 
|  214  |  195  | 
|  215 #endif  // CC_BASE_MATH_UTIL_H_ |  196 #endif  // CC_BASE_MATH_UTIL_H_ | 
| OLD | NEW |