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

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

Issue 2312923002: compare degenerates with tolerance (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | tests/PathTest.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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
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]; 1173 *pts = fPts[0];
1174 SkDEBUGCODE(SkPoint* endPts); 1174 SkDEBUGCODE(SkPoint* endPts);
1175 if (pow2 == kMaxConicToQuadPOW2) { // If an extreme weight generates many q uads ... 1175 if (pow2 == kMaxConicToQuadPOW2) { // If an extreme weight generates many q uads ...
1176 SkConic dst[2]; 1176 SkConic dst[2];
1177 this->chop(dst); 1177 this->chop(dst);
1178 // check to see if the first chop generates a pair of lines 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] ) { 1179 if (dst[0].fPts[1].equalsWithinTolerance(dst[0].fPts[2])
1180 && dst[1].fPts[0].equalsWithinTolerance(dst[1].fPts[1])) {
1180 pts[1] = pts[2] = pts[3] = dst[0].fPts[1]; // set ctrl == end to ma ke lines 1181 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 pts[4] = dst[1].fPts[2];
1182 pow2 = 1; 1183 pow2 = 1;
1183 SkDEBUGCODE(endPts = &pts[5]); 1184 SkDEBUGCODE(endPts = &pts[5]);
1184 goto commonFinitePtCheck; 1185 goto commonFinitePtCheck;
1185 } 1186 }
1186 } 1187 }
1187 SkDEBUGCODE(endPts = ) subdivide(*this, pts + 1, pow2); 1188 SkDEBUGCODE(endPts = ) subdivide(*this, pts + 1, pow2);
1188 commonFinitePtCheck: 1189 commonFinitePtCheck:
1189 const int quadCount = 1 << pow2; 1190 const int quadCount = 1 << pow2;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 matrix.preScale(SK_Scalar1, -SK_Scalar1); 1365 matrix.preScale(SK_Scalar1, -SK_Scalar1);
1365 } 1366 }
1366 if (userMatrix) { 1367 if (userMatrix) {
1367 matrix.postConcat(*userMatrix); 1368 matrix.postConcat(*userMatrix);
1368 } 1369 }
1369 for (int i = 0; i < conicCount; ++i) { 1370 for (int i = 0; i < conicCount; ++i) {
1370 matrix.mapPoints(dst[i].fPts, 3); 1371 matrix.mapPoints(dst[i].fPts, 3);
1371 } 1372 }
1372 return conicCount; 1373 return conicCount;
1373 } 1374 }
OLDNEW
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698