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