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

Side by Side Diff: src/pathops/SkOpSegment.cpp

Issue 556433002: fail when coincidence is too far apart (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: merge fix from trunk for issue 410552 Created 6 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 | « src/pathops/SkOpContour.cpp ('k') | tests/PathOpsOpTest.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 2012 Google Inc. 2 * Copyright 2012 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 #include "SkIntersections.h" 7 #include "SkIntersections.h"
8 #include "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkOpSegment.h" 9 #include "SkOpSegment.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 while (oIndex > 0 && precisely_equal(other->fTs[oIndex - 1].fT, oStartT)) { 1286 while (oIndex > 0 && precisely_equal(other->fTs[oIndex - 1].fT, oStartT)) {
1287 --oIndex; 1287 --oIndex;
1288 } 1288 }
1289 SkSTArray<kOutsideTrackedTCount, SkPoint, true> outsidePts; 1289 SkSTArray<kOutsideTrackedTCount, SkPoint, true> outsidePts;
1290 SkSTArray<kOutsideTrackedTCount, SkPoint, true> oOutsidePts; 1290 SkSTArray<kOutsideTrackedTCount, SkPoint, true> oOutsidePts;
1291 SkOpSpan* test = &fTs[index]; 1291 SkOpSpan* test = &fTs[index];
1292 const SkPoint* testPt = &test->fPt; 1292 const SkPoint* testPt = &test->fPt;
1293 double testT = test->fT; 1293 double testT = test->fT;
1294 SkOpSpan* oTest = &other->fTs[oIndex]; 1294 SkOpSpan* oTest = &other->fTs[oIndex];
1295 const SkPoint* oTestPt = &oTest->fPt; 1295 const SkPoint* oTestPt = &oTest->fPt;
1296 SkASSERT(AlmostEqualUlps(*testPt, *oTestPt)); 1296 // paths with extreme data will fail this test and eject out of pathops alto gether later on
1297 // SkASSERT(AlmostEqualUlps(*testPt, *oTestPt));
1297 do { 1298 do {
1298 SkASSERT(test->fT < 1); 1299 SkASSERT(test->fT < 1);
1299 SkASSERT(oTest->fT < 1); 1300 SkASSERT(oTest->fT < 1);
1300 1301
1301 // consolidate the winding count even if done 1302 // consolidate the winding count even if done
1302 if ((test->fWindValue == 0 && test->fOppValue == 0) 1303 if ((test->fWindValue == 0 && test->fOppValue == 0)
1303 || (oTest->fWindValue == 0 && oTest->fOppValue == 0)) { 1304 || (oTest->fWindValue == 0 && oTest->fOppValue == 0)) {
1304 SkDEBUGCODE(int firstWind = test->fWindValue); 1305 SkDEBUGCODE(int firstWind = test->fWindValue);
1305 SkDEBUGCODE(int firstOpp = test->fOppValue); 1306 SkDEBUGCODE(int firstOpp = test->fOppValue);
1306 do { 1307 do {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 int spanCount = fTs.count(); 1470 int spanCount = fTs.count();
1470 if (spanCount <= 2) { 1471 if (spanCount <= 2) {
1471 return spanCount == 2; 1472 return spanCount == 2;
1472 } 1473 }
1473 int index = 1; 1474 int index = 1;
1474 const SkOpSpan* firstSpan = &fTs[index]; 1475 const SkOpSpan* firstSpan = &fTs[index];
1475 int activePrior = checkSetAngle(0); 1476 int activePrior = checkSetAngle(0);
1476 const SkOpSpan* span = &fTs[0]; 1477 const SkOpSpan* span = &fTs[0];
1477 if (firstSpan->fT == 0 || span->fTiny || span->fOtherT != 1 || span->fOther- >multipleEnds()) { 1478 if (firstSpan->fT == 0 || span->fTiny || span->fOtherT != 1 || span->fOther- >multipleEnds()) {
1478 index = findStartSpan(0); // curve start intersects 1479 index = findStartSpan(0); // curve start intersects
1480 if (fTs[index].fT == 0) {
1481 return false;
1482 }
1479 SkASSERT(index > 0); 1483 SkASSERT(index > 0);
1480 if (activePrior >= 0) { 1484 if (activePrior >= 0) {
1481 addStartSpan(index); 1485 addStartSpan(index);
1482 } 1486 }
1483 } 1487 }
1484 bool addEnd; 1488 bool addEnd;
1485 int endIndex = spanCount - 1; 1489 int endIndex = spanCount - 1;
1486 span = &fTs[endIndex - 1]; 1490 span = &fTs[endIndex - 1];
1487 if ((addEnd = span->fT == 1 || span->fTiny)) { // if curve end intersects 1491 if ((addEnd = span->fT == 1 || span->fTiny)) { // if curve end intersects
1488 endIndex = findEndSpan(endIndex); 1492 endIndex = findEndSpan(endIndex);
(...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after
4392 SkASSERT(span->fWindValue > 0 || span->fOppValue != 0); 4396 SkASSERT(span->fWindValue > 0 || span->fOppValue != 0);
4393 span->fWindValue = 0; 4397 span->fWindValue = 0;
4394 span->fOppValue = 0; 4398 span->fOppValue = 0;
4395 if (span->fTiny || span->fSmall) { 4399 if (span->fTiny || span->fSmall) {
4396 return; 4400 return;
4397 } 4401 }
4398 SkASSERT(!span->fDone); 4402 SkASSERT(!span->fDone);
4399 span->fDone = true; 4403 span->fDone = true;
4400 ++fDoneSpans; 4404 ++fDoneSpans;
4401 } 4405 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpContour.cpp ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698