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 "GrTypes.h" | 10 #include "GrTypes.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 maxEdge = 2; | 242 maxEdge = 2; |
243 } | 243 } |
244 // We could have a tolerance here, not sure if it would improve anything | 244 // We could have a tolerance here, not sure if it would improve anything |
245 if (maxD > 0) { | 245 if (maxD > 0) { |
246 // Set the matrix to give (u = 0, v = distance_to_line) | 246 // Set the matrix to give (u = 0, v = distance_to_line) |
247 SkVector lineVec = qPts[(maxEdge + 1)%3] - qPts[maxEdge]; | 247 SkVector lineVec = qPts[(maxEdge + 1)%3] - qPts[maxEdge]; |
248 // when looking from the point 0 down the line we want positive | 248 // when looking from the point 0 down the line we want positive |
249 // distances to be to the left. This matches the non-degenerate | 249 // distances to be to the left. This matches the non-degenerate |
250 // case. | 250 // case. |
251 lineVec.setOrthog(lineVec, SkPoint::kLeft_Side); | 251 lineVec.setOrthog(lineVec, SkPoint::kLeft_Side); |
252 lineVec.dot(qPts[0]); | |
253 // first row | 252 // first row |
254 fM[0] = 0; | 253 fM[0] = 0; |
255 fM[1] = 0; | 254 fM[1] = 0; |
256 fM[2] = 0; | 255 fM[2] = 0; |
257 // second row | 256 // second row |
258 fM[3] = lineVec.fX; | 257 fM[3] = lineVec.fX; |
259 fM[4] = lineVec.fY; | 258 fM[4] = lineVec.fY; |
260 fM[5] = -lineVec.dot(qPts[maxEdge]); | 259 fM[5] = -lineVec.dot(qPts[maxEdge]); |
261 } else { | 260 } else { |
262 // It's a point. It should cover zero area. Just set the matrix such | 261 // It's a point. It should cover zero area. Just set the matrix such |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 set_loop_klm(d, controlK, controlL, controlM); | 813 set_loop_klm(d, controlK, controlL, controlM); |
815 } else if (kCusp_SkCubicType == cType) { | 814 } else if (kCusp_SkCubicType == cType) { |
816 SkASSERT(0.f == d[0]); | 815 SkASSERT(0.f == d[0]); |
817 set_cusp_klm(d, controlK, controlL, controlM); | 816 set_cusp_klm(d, controlK, controlL, controlM); |
818 } else if (kQuadratic_SkCubicType == cType) { | 817 } else if (kQuadratic_SkCubicType == cType) { |
819 set_quadratic_klm(d, controlK, controlL, controlM); | 818 set_quadratic_klm(d, controlK, controlL, controlM); |
820 } | 819 } |
821 | 820 |
822 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); | 821 calc_cubic_klm(p, controlK, controlL, controlM, klm, &klm[3], &klm[6]); |
823 } | 822 } |
OLD | NEW |