| OLD | NEW |
| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 if (!coincidence->addEndMovedSpans()) { | 478 if (!coincidence->addEndMovedSpans()) { |
| 479 return false; | 479 return false; |
| 480 } | 480 } |
| 481 DEBUG_COINCIDENCE_HEALTH(contourList, "addEndMovedSpans"); | 481 DEBUG_COINCIDENCE_HEALTH(contourList, "addEndMovedSpans"); |
| 482 | 482 |
| 483 const int SAFETY_COUNT = 100; // FIXME: tune | 483 const int SAFETY_COUNT = 100; // FIXME: tune |
| 484 int safetyHatch = SAFETY_COUNT; | 484 int safetyHatch = SAFETY_COUNT; |
| 485 // look for coincidence present in A-B and A-C but missing in B-C | 485 // look for coincidence present in A-B and A-C but missing in B-C |
| 486 while (coincidence->addMissing()) { | 486 while (coincidence->addMissing()) { |
| 487 if (!--safetyHatch) { | 487 if (!--safetyHatch) { |
| 488 SkASSERT(0); // FIXME: take this out after verifying std tests don'
t trigger | 488 SkASSERT(globalState->debugSkipAssert()); |
| 489 return false; | 489 return false; |
| 490 } | 490 } |
| 491 DEBUG_COINCIDENCE_HEALTH(contourList, "addMissing"); | 491 DEBUG_COINCIDENCE_HEALTH(contourList, "addMissing"); |
| 492 moveNearby(contourList); | 492 moveNearby(contourList); |
| 493 DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby"); | 493 DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby"); |
| 494 } | 494 } |
| 495 DEBUG_COINCIDENCE_HEALTH(contourList, "addMissing2"); | 495 DEBUG_COINCIDENCE_HEALTH(contourList, "addMissing2"); |
| 496 // FIXME: only call this if addMissing modified something when returning fal
se | 496 // FIXME: only call this if addMissing modified something when returning fal
se |
| 497 moveNearby(contourList); | 497 moveNearby(contourList); |
| 498 DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby2"); | 498 DEBUG_COINCIDENCE_HEALTH(contourList, "moveNearby2"); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 510 } | 510 } |
| 511 DEBUG_COINCIDENCE_HEALTH(contourList, "moveMultiples2"); | 511 DEBUG_COINCIDENCE_HEALTH(contourList, "moveMultiples2"); |
| 512 moveNearby(contourList); | 512 moveNearby(contourList); |
| 513 } | 513 } |
| 514 #if DEBUG_VALIDATE | 514 #if DEBUG_VALIDATE |
| 515 globalState->setPhase(SkOpGlobalState::kWalking); | 515 globalState->setPhase(SkOpGlobalState::kWalking); |
| 516 #endif | 516 #endif |
| 517 DEBUG_COINCIDENCE_HEALTH(contourList, "expand2"); | 517 DEBUG_COINCIDENCE_HEALTH(contourList, "expand2"); |
| 518 // the expanded ranges may not align -- add the missing spans | 518 // the expanded ranges may not align -- add the missing spans |
| 519 if (!coincidence->addExpanded()) { | 519 if (!coincidence->addExpanded()) { |
| 520 SkASSERT(globalState->debugSkipAssert()); | |
| 521 return false; | 520 return false; |
| 522 } | 521 } |
| 523 DEBUG_COINCIDENCE_HEALTH(contourList, "addExpanded3"); | 522 DEBUG_COINCIDENCE_HEALTH(contourList, "addExpanded3"); |
| 524 coincidence->correctEnds(); | 523 coincidence->correctEnds(); |
| 525 if (!coincidence->mark()) { // mark spans of coincident segments as coincid
ent | 524 if (!coincidence->mark()) { // mark spans of coincident segments as coincid
ent |
| 526 return false; | 525 return false; |
| 527 } | 526 } |
| 528 DEBUG_COINCIDENCE_HEALTH(contourList, "mark1"); | 527 DEBUG_COINCIDENCE_HEALTH(contourList, "mark1"); |
| 529 // look for coincidence lines and curves undetected by intersection | 528 // look for coincidence lines and curves undetected by intersection |
| 530 if (missingCoincidence(contourList)) { | 529 if (missingCoincidence(contourList)) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 } | 582 } |
| 584 #if DEBUG_COINCIDENCE_VERBOSE | 583 #if DEBUG_COINCIDENCE_VERBOSE |
| 585 coincidence->debugShowCoincidence(); | 584 coincidence->debugShowCoincidence(); |
| 586 #endif | 585 #endif |
| 587 #if DEBUG_COINCIDENCE | 586 #if DEBUG_COINCIDENCE |
| 588 coincidence->debugValidate(); | 587 coincidence->debugValidate(); |
| 589 #endif | 588 #endif |
| 590 SkPathOpsDebug::ShowActiveSpans(contourList); | 589 SkPathOpsDebug::ShowActiveSpans(contourList); |
| 591 return true; | 590 return true; |
| 592 } | 591 } |
| OLD | NEW |