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