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

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

Issue 1730293002: fix path ops fuzz bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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.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 "SkAddIntersections.h" 7 #include "SkAddIntersections.h"
8 #include "SkOpCoincidence.h" 8 #include "SkOpCoincidence.h"
9 #include "SkOpEdgeBuilder.h" 9 #include "SkOpEdgeBuilder.h"
10 #include "SkPathOpsCommon.h" 10 #include "SkPathOpsCommon.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 static bool missingCoincidence(SkOpContourHead* contourList, 418 static bool missingCoincidence(SkOpContourHead* contourList,
419 SkOpCoincidence* coincidence, SkChunkAlloc* allocator) { 419 SkOpCoincidence* coincidence, SkChunkAlloc* allocator) {
420 SkOpContour* contour = contourList; 420 SkOpContour* contour = contourList;
421 bool result = false; 421 bool result = false;
422 do { 422 do {
423 result |= contour->missingCoincidence(coincidence, allocator); 423 result |= contour->missingCoincidence(coincidence, allocator);
424 } while ((contour = contour->next())); 424 } while ((contour = contour->next()));
425 return result; 425 return result;
426 } 426 }
427 427
428 static void moveMultiples(SkOpContourHead* contourList) { 428 static bool moveMultiples(SkOpContourHead* contourList) {
429 SkOpContour* contour = contourList; 429 SkOpContour* contour = contourList;
430 do { 430 do {
431 contour->moveMultiples(); 431 if (!contour->moveMultiples()) {
432 return false;
433 }
432 } while ((contour = contour->next())); 434 } while ((contour = contour->next()));
435 return true;
433 } 436 }
434 437
435 static void moveNearby(SkOpContourHead* contourList) { 438 static void moveNearby(SkOpContourHead* contourList) {
436 SkOpContour* contour = contourList; 439 SkOpContour* contour = contourList;
437 do { 440 do {
438 contour->moveNearby(); 441 contour->moveNearby();
439 } while ((contour = contour->next())); 442 } while ((contour = contour->next()));
440 } 443 }
441 444
442 static void sortAngles(SkOpContourHead* contourList) { 445 static void sortAngles(SkOpContourHead* contourList) {
443 SkOpContour* contour = contourList; 446 SkOpContour* contour = contourList;
444 do { 447 do {
445 contour->sortAngles(); 448 contour->sortAngles();
446 } while ((contour = contour->next())); 449 } while ((contour = contour->next()));
447 } 450 }
448 451
449 bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc e, 452 bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc e,
450 SkChunkAlloc* allocator) { 453 SkChunkAlloc* allocator) {
451 SkOpGlobalState* globalState = contourList->globalState(); 454 SkOpGlobalState* globalState = contourList->globalState();
452 // combine t values when multiple intersections occur on some segments but n ot others 455 // combine t values when multiple intersections occur on some segments but n ot others
453 DEBUG_COINCIDENCE_HEALTH(contourList, "start"); 456 DEBUG_COINCIDENCE_HEALTH(contourList, "start");
454 moveMultiples(contourList); 457 if (!moveMultiples(contourList)) {
458 return false;
459 }
455 DEBUG_COINCIDENCE_HEALTH(contourList, "moveMultiples"); 460 DEBUG_COINCIDENCE_HEALTH(contourList, "moveMultiples");
456 findCollapsed(contourList); 461 findCollapsed(contourList);
457 DEBUG_COINCIDENCE_HEALTH(contourList, "findCollapsed"); 462 DEBUG_COINCIDENCE_HEALTH(contourList, "findCollapsed");
458 // move t values and points together to eliminate small/tiny gaps 463 // move t values and points together to eliminate small/tiny gaps
459 moveNearby(contourList); 464 moveNearby(contourList);
460 DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby"); 465 DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby");
461 align(contourList); // give all span members common values 466 align(contourList); // give all span members common values
462 DEBUG_COINCIDENCE_HEALTH(contourList, "align"); 467 DEBUG_COINCIDENCE_HEALTH(contourList, "align");
463 coincidence->fixAligned(); // aligning may have marked a coincidence pt-t d eleted 468 coincidence->fixAligned(); // aligning may have marked a coincidence pt-t d eleted
464 DEBUG_COINCIDENCE_HEALTH(contourList, "fixAligned"); 469 DEBUG_COINCIDENCE_HEALTH(contourList, "fixAligned");
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (!coincidence->apply()) { 527 if (!coincidence->apply()) {
523 return false; 528 return false;
524 } 529 }
525 } 530 }
526 #if DEBUG_ACTIVE_SPANS 531 #if DEBUG_ACTIVE_SPANS
527 coincidence->debugShowCoincidence(); 532 coincidence->debugShowCoincidence();
528 DebugShowActiveSpans(contourList); 533 DebugShowActiveSpans(contourList);
529 #endif 534 #endif
530 return true; 535 return true;
531 } 536 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpSegment.cpp ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698