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

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

Issue 1730293002: fix path ops fuzz bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/SkOpSegment.h ('k') | src/pathops/SkPathOpsCommon.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 "SkOpCoincidence.h" 7 #include "SkOpCoincidence.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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 if (swapped) { 1290 if (swapped) {
1291 SkTSwap(priorPtT, ptT); 1291 SkTSwap(priorPtT, ptT);
1292 } 1292 }
1293 } 1293 }
1294 } while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next( ))); 1294 } while ((spanBase = spanBase->final() ? nullptr : spanBase->upCast()->next( )));
1295 clear_visited(&fHead); 1295 clear_visited(&fHead);
1296 return false; 1296 return false;
1297 } 1297 }
1298 1298
1299 // if a span has more than one intersection, merge the other segments' span as n eeded 1299 // if a span has more than one intersection, merge the other segments' span as n eeded
1300 void SkOpSegment::moveMultiples() { 1300 bool SkOpSegment::moveMultiples() {
1301 debugValidate(); 1301 debugValidate();
1302 SkOpSpanBase* test = &fHead; 1302 SkOpSpanBase* test = &fHead;
1303 do { 1303 do {
1304 int addCount = test->spanAddsCount(); 1304 int addCount = test->spanAddsCount();
1305 SkASSERT(addCount >= 1); 1305 if (addCount < 1) {
1306 return false;
1307 }
1306 if (addCount == 1) { 1308 if (addCount == 1) {
1307 continue; 1309 continue;
1308 } 1310 }
1309 SkOpPtT* startPtT = test->ptT(); 1311 SkOpPtT* startPtT = test->ptT();
1310 SkOpPtT* testPtT = startPtT; 1312 SkOpPtT* testPtT = startPtT;
1311 do { // iterate through all spans associated with start 1313 do { // iterate through all spans associated with start
1312 SkOpSpanBase* oppSpan = testPtT->span(); 1314 SkOpSpanBase* oppSpan = testPtT->span();
1313 if (oppSpan->spanAddsCount() == addCount) { 1315 if (oppSpan->spanAddsCount() == addCount) {
1314 continue; 1316 continue;
1315 } 1317 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 goto checkNextSpan; 1388 goto checkNextSpan;
1387 } 1389 }
1388 tryNextSpan: 1390 tryNextSpan:
1389 ; 1391 ;
1390 } while (oppTest != oppLast && (oppTest = oppTest->upCast()->next()) ); 1392 } while (oppTest != oppLast && (oppTest = oppTest->upCast()->next()) );
1391 } while ((testPtT = testPtT->next()) != startPtT); 1393 } while ((testPtT = testPtT->next()) != startPtT);
1392 checkNextSpan: 1394 checkNextSpan:
1393 ; 1395 ;
1394 } while ((test = test->final() ? nullptr : test->upCast()->next())); 1396 } while ((test = test->final() ? nullptr : test->upCast()->next()));
1395 debugValidate(); 1397 debugValidate();
1398 return true;
1396 } 1399 }
1397 1400
1398 // Move nearby t values and pts so they all hang off the same span. Alignment ha ppens later. 1401 // Move nearby t values and pts so they all hang off the same span. Alignment ha ppens later.
1399 void SkOpSegment::moveNearby() { 1402 void SkOpSegment::moveNearby() {
1400 debugValidate(); 1403 debugValidate();
1401 SkOpSpanBase* spanS = &fHead; 1404 SkOpSpanBase* spanS = &fHead;
1402 do { 1405 do {
1403 SkOpSpanBase* test = spanS->upCast()->next(); 1406 SkOpSpanBase* test = spanS->upCast()->next();
1404 SkOpSpanBase* next; 1407 SkOpSpanBase* next;
1405 if (spanS->contains(test)) { 1408 if (spanS->contains(test)) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 int absOut = SkTAbs(outerWinding); 1778 int absOut = SkTAbs(outerWinding);
1776 int absIn = SkTAbs(innerWinding); 1779 int absIn = SkTAbs(innerWinding);
1777 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; 1780 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn;
1778 return result; 1781 return result;
1779 } 1782 }
1780 1783
1781 int SkOpSegment::windSum(const SkOpAngle* angle) const { 1784 int SkOpSegment::windSum(const SkOpAngle* angle) const {
1782 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); 1785 const SkOpSpan* minSpan = angle->start()->starter(angle->end());
1783 return minSpan->windSum(); 1786 return minSpan->windSum();
1784 } 1787 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpSegment.h ('k') | src/pathops/SkPathOpsCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698