OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkGeometry.h" | 8 #include "SkGeometry.h" |
9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
10 #include "SkNx.h" | 10 #include "SkNx.h" |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 SkConic dst[2]; | 1163 SkConic dst[2]; |
1164 src.chop(dst); | 1164 src.chop(dst); |
1165 --level; | 1165 --level; |
1166 pts = subdivide(dst[0], pts, level); | 1166 pts = subdivide(dst[0], pts, level); |
1167 return subdivide(dst[1], pts, level); | 1167 return subdivide(dst[1], pts, level); |
1168 } | 1168 } |
1169 } | 1169 } |
1170 | 1170 |
1171 int SkConic::chopIntoQuadsPOW2(SkPoint pts[], int pow2) const { | 1171 int SkConic::chopIntoQuadsPOW2(SkPoint pts[], int pow2) const { |
1172 SkASSERT(pow2 >= 0); | 1172 SkASSERT(pow2 >= 0); |
| 1173 *pts = fPts[0]; |
| 1174 SkDEBUGCODE(SkPoint* endPts); |
| 1175 if (pow2 == kMaxConicToQuadPOW2) { // If an extreme weight generates many q
uads ... |
| 1176 SkConic dst[2]; |
| 1177 this->chop(dst); |
| 1178 // check to see if the first chop generates a pair of lines |
| 1179 if (dst[0].fPts[1] == dst[0].fPts[2] && dst[1].fPts[0] == dst[1].fPts[1]
) { |
| 1180 pts[1] = pts[2] = pts[3] = dst[0].fPts[1]; // set ctrl == end to ma
ke lines |
| 1181 pts[4] = dst[1].fPts[2]; |
| 1182 pow2 = 1; |
| 1183 SkDEBUGCODE(endPts = &pts[5]); |
| 1184 goto commonFinitePtCheck; |
| 1185 } |
| 1186 } |
| 1187 SkDEBUGCODE(endPts = ) subdivide(*this, pts + 1, pow2); |
| 1188 commonFinitePtCheck: |
1173 const int quadCount = 1 << pow2; | 1189 const int quadCount = 1 << pow2; |
1174 const int ptCount = 2 * quadCount + 1; | 1190 const int ptCount = 2 * quadCount + 1; |
1175 *pts = fPts[0]; | |
1176 SkDEBUGCODE(SkPoint* endPts =) subdivide(*this, pts + 1, pow2); | |
1177 SkASSERT(endPts - pts == ptCount); | 1191 SkASSERT(endPts - pts == ptCount); |
1178 if (!SkPointsAreFinite(pts, ptCount)) { | 1192 if (!SkPointsAreFinite(pts, ptCount)) { |
1179 // if we generated a non-finite, pin ourselves to the middle of the hull
, | 1193 // if we generated a non-finite, pin ourselves to the middle of the hull
, |
1180 // as our first and last are already on the first/last pts of the hull. | 1194 // as our first and last are already on the first/last pts of the hull. |
1181 for (int i = 1; i < ptCount - 1; ++i) { | 1195 for (int i = 1; i < ptCount - 1; ++i) { |
1182 pts[i] = fPts[1]; | 1196 pts[i] = fPts[1]; |
1183 } | 1197 } |
1184 } | 1198 } |
1185 return 1 << pow2; | 1199 return 1 << pow2; |
1186 } | 1200 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 matrix.preScale(SK_Scalar1, -SK_Scalar1); | 1362 matrix.preScale(SK_Scalar1, -SK_Scalar1); |
1349 } | 1363 } |
1350 if (userMatrix) { | 1364 if (userMatrix) { |
1351 matrix.postConcat(*userMatrix); | 1365 matrix.postConcat(*userMatrix); |
1352 } | 1366 } |
1353 for (int i = 0; i < conicCount; ++i) { | 1367 for (int i = 0; i < conicCount; ++i) { |
1354 matrix.mapPoints(dst[i].fPts, 3); | 1368 matrix.mapPoints(dst[i].fPts, 3); |
1355 } | 1369 } |
1356 return conicCount; | 1370 return conicCount; |
1357 } | 1371 } |
OLD | NEW |