| 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 <memory> | 10 #include <memory> |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // If the value is inf, returns max double/float representation. | 289 // If the value is inf, returns max double/float representation. |
| 290 static double AsDoubleSafely(double value); | 290 static double AsDoubleSafely(double value); |
| 291 static float AsFloatSafely(float value); | 291 static float AsFloatSafely(float value); |
| 292 | 292 |
| 293 // Returns vector that x axis (1,0,0) transforms to under given transform. | 293 // Returns vector that x axis (1,0,0) transforms to under given transform. |
| 294 static gfx::Vector3dF GetXAxis(const gfx::Transform& transform); | 294 static gfx::Vector3dF GetXAxis(const gfx::Transform& transform); |
| 295 | 295 |
| 296 // Returns vector that y axis (0,1,0) transforms to under given transform. | 296 // Returns vector that y axis (0,1,0) transforms to under given transform. |
| 297 static gfx::Vector3dF GetYAxis(const gfx::Transform& transform); | 297 static gfx::Vector3dF GetYAxis(const gfx::Transform& transform); |
| 298 | 298 |
| 299 static bool IsNearlyTheSameForTesting(float left, float right); | 299 static bool IsFloatNearlyTheSame(float left, float right); |
| 300 static bool IsNearlyTheSameForTesting(const gfx::PointF& l, | 300 static bool IsNearlyTheSameForTesting(const gfx::PointF& l, |
| 301 const gfx::PointF& r); | 301 const gfx::PointF& r); |
| 302 static bool IsNearlyTheSameForTesting(const gfx::Point3F& l, | 302 static bool IsNearlyTheSameForTesting(const gfx::Point3F& l, |
| 303 const gfx::Point3F& r); | 303 const gfx::Point3F& r); |
| 304 | 304 |
| 305 private: | 305 private: |
| 306 template <typename T> | 306 template <typename T> |
| 307 static T RoundUpInternal(T n, T mul) { | 307 static T RoundUpInternal(T n, T mul) { |
| 308 return (n > 0) ? ((n + mul - 1) / mul) * mul : (n / mul) * mul; | 308 return (n > 0) ? ((n + mul - 1) / mul) * mul : (n / mul) * mul; |
| 309 } | 309 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 323 private: | 323 private: |
| 324 #ifdef __SSE__ | 324 #ifdef __SSE__ |
| 325 unsigned int orig_state_; | 325 unsigned int orig_state_; |
| 326 #endif | 326 #endif |
| 327 DISALLOW_COPY_AND_ASSIGN(ScopedSubnormalFloatDisabler); | 327 DISALLOW_COPY_AND_ASSIGN(ScopedSubnormalFloatDisabler); |
| 328 }; | 328 }; |
| 329 | 329 |
| 330 } // namespace cc | 330 } // namespace cc |
| 331 | 331 |
| 332 #endif // CC_BASE_MATH_UTIL_H_ | 332 #endif // CC_BASE_MATH_UTIL_H_ |
| OLD | NEW |