| 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_MATH_UTIL_H_ | 5 #ifndef CC_MATH_UTIL_H_ |
| 6 #define CC_MATH_UTIL_H_ | 6 #define CC_MATH_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 static gfx::Vector2dF computeTransform2dScaleComponents(const gfx::Transform
&, float fallbackValue); | 113 static gfx::Vector2dF computeTransform2dScaleComponents(const gfx::Transform
&, float fallbackValue); |
| 114 | 114 |
| 115 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is | 115 // Returns the smallest angle between the given two vectors in degrees. Neit
her vector is |
| 116 // assumed to be normalized. | 116 // assumed to be normalized. |
| 117 static float smallestAngleBetweenVectors(gfx::Vector2dF, gfx::Vector2dF); | 117 static float smallestAngleBetweenVectors(gfx::Vector2dF, gfx::Vector2dF); |
| 118 | 118 |
| 119 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. | 119 // Projects the |source| vector onto |destination|. Neither vector is assume
d to be normalized. |
| 120 static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF de
stination); | 120 static gfx::Vector2dF projectVector(gfx::Vector2dF source, gfx::Vector2dF de
stination); |
| 121 | 121 |
| 122 // Returns true if screen point hits a rect |
| 123 static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const gfx::Tr
ansform& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect); |
| 124 |
| 122 // Conversion to value. | 125 // Conversion to value. |
| 123 static scoped_ptr<base::Value> asValue(gfx::Size s); | 126 static scoped_ptr<base::Value> asValue(gfx::Size s); |
| 124 static scoped_ptr<base::Value> asValue(gfx::PointF q); | 127 static scoped_ptr<base::Value> asValue(gfx::PointF q); |
| 125 static scoped_ptr<base::Value> asValue(gfx::QuadF q); | 128 static scoped_ptr<base::Value> asValue(gfx::QuadF q); |
| 126 | 129 |
| 127 // Returns a base::Value representation of the floating point value. | 130 // Returns a base::Value representation of the floating point value. |
| 128 // If the value is inf, returns max double/float representation. | 131 // If the value is inf, returns max double/float representation. |
| 129 static scoped_ptr<base::Value> asValueSafely(double value); | 132 static scoped_ptr<base::Value> asValueSafely(double value); |
| 130 static scoped_ptr<base::Value> asValueSafely(float value); | 133 static scoped_ptr<base::Value> asValueSafely(float value); |
| 131 | 134 |
| 132 }; | 135 }; |
| 133 | 136 |
| 134 } // namespace cc | 137 } // namespace cc |
| 135 | 138 |
| 136 #endif // CC_MATH_UTIL_H_ | 139 #endif // CC_MATH_UTIL_H_ |
| OLD | NEW |