Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: src/core/SkGeometry.cpp

Issue 2142393003: handle large conic weights (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another double warning Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkPoint.h ('k') | tests/GeometryTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 const int quadCount = 1 << pow2;
1174 const int ptCount = 2 * quadCount + 1;
1173 *pts = fPts[0]; 1175 *pts = fPts[0];
1174 SkDEBUGCODE(SkPoint* endPts =) subdivide(*this, pts + 1, pow2); 1176 SkDEBUGCODE(SkPoint* endPts =) subdivide(*this, pts + 1, pow2);
1175 SkASSERT(endPts - pts == (2 * (1 << pow2) + 1)); 1177 SkASSERT(endPts - pts == ptCount);
1178 if (!SkPointsAreFinite(pts, ptCount)) {
1179 // 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.
1181 for (int i = 1; i < ptCount - 1; ++i) {
1182 pts[i] = fPts[1];
1183 }
1184 }
1176 return 1 << pow2; 1185 return 1 << pow2;
1177 } 1186 }
1178 1187
1179 bool SkConic::findXExtrema(SkScalar* t) const { 1188 bool SkConic::findXExtrema(SkScalar* t) const {
1180 return conic_find_extrema(&fPts[0].fX, fW, t); 1189 return conic_find_extrema(&fPts[0].fX, fW, t);
1181 } 1190 }
1182 1191
1183 bool SkConic::findYExtrema(SkScalar* t) const { 1192 bool SkConic::findYExtrema(SkScalar* t) const {
1184 return conic_find_extrema(&fPts[0].fY, fW, t); 1193 return conic_find_extrema(&fPts[0].fY, fW, t);
1185 } 1194 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 matrix.preScale(SK_Scalar1, -SK_Scalar1); 1348 matrix.preScale(SK_Scalar1, -SK_Scalar1);
1340 } 1349 }
1341 if (userMatrix) { 1350 if (userMatrix) {
1342 matrix.postConcat(*userMatrix); 1351 matrix.postConcat(*userMatrix);
1343 } 1352 }
1344 for (int i = 0; i < conicCount; ++i) { 1353 for (int i = 0; i < conicCount; ++i) {
1345 matrix.mapPoints(dst[i].fPts, 3); 1354 matrix.mapPoints(dst[i].fPts, 3);
1346 } 1355 }
1347 return conicCount; 1356 return conicCount;
1348 } 1357 }
OLDNEW
« no previous file with comments | « include/core/SkPoint.h ('k') | tests/GeometryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698