| 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 <vector> | 10 #include <vector> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // clipped, transformed polygon. | 108 // clipped, transformed polygon. |
| 109 static gfx::Rect MapEnclosingClippedRect(const gfx::Transform& transform, | 109 static gfx::Rect MapEnclosingClippedRect(const gfx::Transform& transform, |
| 110 const gfx::Rect& rect); | 110 const gfx::Rect& rect); |
| 111 static gfx::RectF MapClippedRect(const gfx::Transform& transform, | 111 static gfx::RectF MapClippedRect(const gfx::Transform& transform, |
| 112 const gfx::RectF& rect); | 112 const gfx::RectF& rect); |
| 113 static gfx::Rect ProjectEnclosingClippedRect(const gfx::Transform& transform, | 113 static gfx::Rect ProjectEnclosingClippedRect(const gfx::Transform& transform, |
| 114 const gfx::Rect& rect); | 114 const gfx::Rect& rect); |
| 115 static gfx::RectF ProjectClippedRect(const gfx::Transform& transform, | 115 static gfx::RectF ProjectClippedRect(const gfx::Transform& transform, |
| 116 const gfx::RectF& rect); | 116 const gfx::RectF& rect); |
| 117 | 117 |
| 118 // This function is only valid when the transform preserves 2d axis |
| 119 // alignment and the resulting rect will not be clipped. |
| 120 static gfx::Rect MapEnclosedRectWith2dAxisAlignedTransform( |
| 121 const gfx::Transform& transform, |
| 122 const gfx::Rect& rect); |
| 123 |
| 118 // Returns an array of vertices that represent the clipped polygon. After | 124 // Returns an array of vertices that represent the clipped polygon. After |
| 119 // returning, indexes from 0 to num_vertices_in_clipped_quad are valid in the | 125 // returning, indexes from 0 to num_vertices_in_clipped_quad are valid in the |
| 120 // clipped_quad array. Note that num_vertices_in_clipped_quad may be zero, | 126 // clipped_quad array. Note that num_vertices_in_clipped_quad may be zero, |
| 121 // which means the entire quad was clipped, and none of the vertices in the | 127 // which means the entire quad was clipped, and none of the vertices in the |
| 122 // array are valid. | 128 // array are valid. |
| 123 static void MapClippedQuad(const gfx::Transform& transform, | 129 static void MapClippedQuad(const gfx::Transform& transform, |
| 124 const gfx::QuadF& src_quad, | 130 const gfx::QuadF& src_quad, |
| 125 gfx::PointF clipped_quad[8], | 131 gfx::PointF clipped_quad[8], |
| 126 int* num_vertices_in_clipped_quad); | 132 int* num_vertices_in_clipped_quad); |
| 127 static bool MapClippedQuad3d(const gfx::Transform& transform, | 133 static bool MapClippedQuad3d(const gfx::Transform& transform, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 223 |
| 218 // Returns a base::Value representation of the floating point value. | 224 // Returns a base::Value representation of the floating point value. |
| 219 // If the value is inf, returns max double/float representation. | 225 // If the value is inf, returns max double/float representation. |
| 220 static double AsDoubleSafely(double value); | 226 static double AsDoubleSafely(double value); |
| 221 static float AsFloatSafely(float value); | 227 static float AsFloatSafely(float value); |
| 222 }; | 228 }; |
| 223 | 229 |
| 224 } // namespace cc | 230 } // namespace cc |
| 225 | 231 |
| 226 #endif // CC_BASE_MATH_UTIL_H_ | 232 #endif // CC_BASE_MATH_UTIL_H_ |
| OLD | NEW |