| 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 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 static float SmallestAngleBetweenVectors(gfx::Vector2dF v1, | 143 static float SmallestAngleBetweenVectors(gfx::Vector2dF v1, |
| 144 gfx::Vector2dF v2); | 144 gfx::Vector2dF v2); |
| 145 | 145 |
| 146 // Projects the |source| vector onto |destination|. Neither vector is assumed | 146 // Projects the |source| vector onto |destination|. Neither vector is assumed |
| 147 // to be normalized. | 147 // to be normalized. |
| 148 static gfx::Vector2dF ProjectVector(gfx::Vector2dF source, | 148 static gfx::Vector2dF ProjectVector(gfx::Vector2dF source, |
| 149 gfx::Vector2dF destination); | 149 gfx::Vector2dF destination); |
| 150 | 150 |
| 151 // Conversion to value. | 151 // Conversion to value. |
| 152 static scoped_ptr<base::Value> AsValue(gfx::Size s); | 152 static scoped_ptr<base::Value> AsValue(gfx::Size s); |
| 153 static scoped_ptr<base::Value> AsValue(gfx::SizeF s); |
| 153 static scoped_ptr<base::Value> AsValue(gfx::Rect r); | 154 static scoped_ptr<base::Value> AsValue(gfx::Rect r); |
| 154 static bool FromValue(const base::Value*, gfx::Rect* out_rect); | 155 static bool FromValue(const base::Value*, gfx::Rect* out_rect); |
| 155 static scoped_ptr<base::Value> AsValue(gfx::PointF q); | 156 static scoped_ptr<base::Value> AsValue(gfx::PointF q); |
| 156 static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q); | 157 static scoped_ptr<base::Value> AsValue(const gfx::QuadF& q); |
| 157 static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect); | 158 static scoped_ptr<base::Value> AsValue(const gfx::RectF& rect); |
| 159 static scoped_ptr<base::Value> AsValue(const gfx::Transform& transform); |
| 158 | 160 |
| 159 // Returns a base::Value representation of the floating point value. | 161 // Returns a base::Value representation of the floating point value. |
| 160 // If the value is inf, returns max double/float representation. | 162 // If the value is inf, returns max double/float representation. |
| 161 static scoped_ptr<base::Value> AsValueSafely(double value); | 163 static scoped_ptr<base::Value> AsValueSafely(double value); |
| 162 static scoped_ptr<base::Value> AsValueSafely(float value); | 164 static scoped_ptr<base::Value> AsValueSafely(float value); |
| 163 }; | 165 }; |
| 164 | 166 |
| 165 } // namespace cc | 167 } // namespace cc |
| 166 | 168 |
| 167 #endif // CC_BASE_MATH_UTIL_H_ | 169 #endif // CC_BASE_MATH_UTIL_H_ |
| OLD | NEW |