OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrPathUtils.h" | 8 #include "GrPathUtils.h" |
9 | 9 |
10 #include "GrPoint.h" | 10 #include "GrPoint.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 break; | 180 break; |
181 default: | 181 default: |
182 break; | 182 break; |
183 } | 183 } |
184 first = false; | 184 first = false; |
185 } | 185 } |
186 return pointCount; | 186 return pointCount; |
187 } | 187 } |
188 | 188 |
189 void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) { | 189 void GrPathUtils::QuadUVMatrix::set(const GrPoint qPts[3]) { |
190 #ifndef SK_SCALAR_IS_FLOAT | |
191 GrCrash("Expected scalar is float."); | |
192 #endif | |
193 SkMatrix m; | 190 SkMatrix m; |
194 // We want M such that M * xy_pt = uv_pt | 191 // We want M such that M * xy_pt = uv_pt |
195 // We know M * control_pts = [0 1/2 1] | 192 // We know M * control_pts = [0 1/2 1] |
196 // [0 0 1] | 193 // [0 0 1] |
197 // [1 1 1] | 194 // [1 1 1] |
198 // And control_pts = [x0 x1 x2] | 195 // And control_pts = [x0 x1 x2] |
199 // [y0 y1 y2] | 196 // [y0 y1 y2] |
200 // [1 1 1 ] | 197 // [1 1 1 ] |
201 // We invert the control pt matrix and post concat to both sides to get M. | 198 // We invert the control pt matrix and post concat to both sides to get M. |
202 // Using the known form of the control point matrix and the result, we can | 199 // Using the known form of the control point matrix and the result, we can |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 set_loop_klm(d, controlK, controlL, controlM); | 859 set_loop_klm(d, controlK, controlL, controlM); |
863 } else if (kCusp_CubicType == cType) { | 860 } else if (kCusp_CubicType == cType) { |
864 SkASSERT(0.f == d[0]); | 861 SkASSERT(0.f == d[0]); |
865 set_cusp_klm(d, controlK, controlL, controlM); | 862 set_cusp_klm(d, controlK, controlL, controlM); |
866 } else if (kQuadratic_CubicType == cType) { | 863 } else if (kQuadratic_CubicType == cType) { |
867 set_quadratic_klm(d, controlK, controlL, controlM); | 864 set_quadratic_klm(d, controlK, controlL, controlM); |
868 } | 865 } |
869 | 866 |
870 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); | 867 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); |
871 } | 868 } |
OLD | NEW |