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 <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const gfx::RectF& rect); | 95 const gfx::RectF& rect); |
96 | 96 |
97 // Returns an array of vertices that represent the clipped polygon. After | 97 // Returns an array of vertices that represent the clipped polygon. After |
98 // returning, indexes from 0 to num_vertices_in_clipped_quad are valid in the | 98 // returning, indexes from 0 to num_vertices_in_clipped_quad are valid in the |
99 // clipped_quad array. Note that num_vertices_in_clipped_quad may be zero, | 99 // clipped_quad array. Note that num_vertices_in_clipped_quad may be zero, |
100 // which means the entire quad was clipped, and none of the vertices in the | 100 // which means the entire quad was clipped, and none of the vertices in the |
101 // array are valid. | 101 // array are valid. |
102 static void MapClippedQuad(const gfx::Transform& transform, | 102 static void MapClippedQuad(const gfx::Transform& transform, |
103 const gfx::QuadF& src_quad, | 103 const gfx::QuadF& src_quad, |
104 gfx::PointF clipped_quad[8], | 104 gfx::PointF clipped_quad[8], |
105 int& num_vertices_in_clipped_quad); | 105 int* num_vertices_in_clipped_quad); |
106 | 106 |
107 static gfx::RectF ComputeEnclosingRectOfVertices(gfx::PointF vertices[], | 107 static gfx::RectF ComputeEnclosingRectOfVertices(gfx::PointF vertices[], |
108 int num_vertices); | 108 int num_vertices); |
109 static gfx::RectF ComputeEnclosingClippedRect( | 109 static gfx::RectF ComputeEnclosingClippedRect( |
110 const HomogeneousCoordinate& h1, | 110 const HomogeneousCoordinate& h1, |
111 const HomogeneousCoordinate& h2, | 111 const HomogeneousCoordinate& h2, |
112 const HomogeneousCoordinate& h3, | 112 const HomogeneousCoordinate& h3, |
113 const HomogeneousCoordinate& h4); | 113 const HomogeneousCoordinate& h4); |
114 | 114 |
115 // NOTE: These functions do not do correct clipping against w = 0 plane, but | 115 // NOTE: These functions do not do correct clipping against w = 0 plane, but |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // Returns a base::Value representation of the floating point value. | 151 // Returns a base::Value representation of the floating point value. |
152 // If the value is inf, returns max double/float representation. | 152 // If the value is inf, returns max double/float representation. |
153 static scoped_ptr<base::Value> AsValueSafely(double value); | 153 static scoped_ptr<base::Value> AsValueSafely(double value); |
154 static scoped_ptr<base::Value> AsValueSafely(float value); | 154 static scoped_ptr<base::Value> AsValueSafely(float value); |
155 }; | 155 }; |
156 | 156 |
157 } // namespace cc | 157 } // namespace cc |
158 | 158 |
159 #endif // CC_BASE_MATH_UTIL_H_ | 159 #endif // CC_BASE_MATH_UTIL_H_ |
OLD | NEW |