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 MapEnclosedNonClippedRect(const gfx::Transform& transform, |
| 121 const gfx::Rect& rect); |
| 122 |
118 // Returns an array of vertices that represent the clipped polygon. After | 123 // 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 | 124 // 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, | 125 // 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 | 126 // which means the entire quad was clipped, and none of the vertices in the |
122 // array are valid. | 127 // array are valid. |
123 static void MapClippedQuad(const gfx::Transform& transform, | 128 static void MapClippedQuad(const gfx::Transform& transform, |
124 const gfx::QuadF& src_quad, | 129 const gfx::QuadF& src_quad, |
125 gfx::PointF clipped_quad[8], | 130 gfx::PointF clipped_quad[8], |
126 int* num_vertices_in_clipped_quad); | 131 int* num_vertices_in_clipped_quad); |
127 static bool MapClippedQuad3d(const gfx::Transform& transform, | 132 static bool MapClippedQuad3d(const gfx::Transform& transform, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 222 |
218 // Returns a base::Value representation of the floating point value. | 223 // Returns a base::Value representation of the floating point value. |
219 // If the value is inf, returns max double/float representation. | 224 // If the value is inf, returns max double/float representation. |
220 static double AsDoubleSafely(double value); | 225 static double AsDoubleSafely(double value); |
221 static float AsFloatSafely(float value); | 226 static float AsFloatSafely(float value); |
222 }; | 227 }; |
223 | 228 |
224 } // namespace cc | 229 } // namespace cc |
225 | 230 |
226 #endif // CC_BASE_MATH_UTIL_H_ | 231 #endif // CC_BASE_MATH_UTIL_H_ |
OLD | NEW |