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

Unified Diff: src/pathops/SkPathOpsSimplify.cpp

Issue 272153002: fix bugs found by computing flat clips in 800K skps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix maybe-uninitialized error in unbuntu Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkPathOpsPoint.h ('k') | src/pathops/SkPathOpsTriangle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsSimplify.cpp
diff --git a/src/pathops/SkPathOpsSimplify.cpp b/src/pathops/SkPathOpsSimplify.cpp
index 0917b69e475ab19069e3736f6a60e2da5d9441df..57090ac4238bd658cf8bdc60c4cbee8113679ad4 100644
--- a/src/pathops/SkPathOpsSimplify.cpp
+++ b/src/pathops/SkPathOpsSimplify.cpp
@@ -19,9 +19,10 @@ static bool bridgeWinding(SkTArray<SkOpContour*, true>& contourList, SkPathWrite
do {
int index, endIndex;
bool topDone;
+ bool onlyVertical = false;
lastTopLeft = topLeft;
SkOpSegment* current = FindSortableTop(contourList, SkOpAngle::kUnaryWinding, &firstContour,
- &index, &endIndex, &topLeft, &topUnsortable, &topDone, firstPass);
+ &index, &endIndex, &topLeft, &topUnsortable, &topDone, &onlyVertical, firstPass);
if (!current) {
if ((!topUnsortable || firstPass) && !topDone) {
SkASSERT(topLeft.fX != SK_ScalarMin && topLeft.fY != SK_ScalarMin);
@@ -29,22 +30,21 @@ static bool bridgeWinding(SkTArray<SkOpContour*, true>& contourList, SkPathWrite
continue;
}
break;
+ } else if (onlyVertical) {
+ break;
}
firstPass = !topUnsortable || lastTopLeft != topLeft;
- SkTDArray<SkOpSpan*> chaseArray;
+ SkTDArray<SkOpSpan*> chase;
do {
if (current->activeWinding(index, endIndex)) {
do {
if (!unsortable && current->done()) {
- if (simple->isEmpty()) {
- simple->init();
- break;
- }
+ break;
}
SkASSERT(unsortable || !current->done());
int nextStart = index;
int nextEnd = endIndex;
- SkOpSegment* next = current->findNextWinding(&chaseArray, &nextStart, &nextEnd,
+ SkOpSegment* next = current->findNextWinding(&chase, &nextStart, &nextEnd,
&unsortable);
if (!next) {
if (!unsortable && simple->hasMove()
@@ -67,7 +67,7 @@ static bool bridgeWinding(SkTArray<SkOpContour*, true>& contourList, SkPathWrite
} while (!simple->isClosed() && (!unsortable
|| !current->done(SkMin32(index, endIndex))));
if (current->activeWinding(index, endIndex) && !simple->isClosed()) {
- SkASSERT(unsortable || simple->isEmpty());
+// SkASSERT(unsortable || simple->isEmpty());
int min = SkMin32(index, endIndex);
if (!current->done(min)) {
current->addCurveTo(index, endIndex, simple, true);
@@ -79,13 +79,17 @@ static bool bridgeWinding(SkTArray<SkOpContour*, true>& contourList, SkPathWrite
SkOpSpan* last = current->markAndChaseDoneUnary(index, endIndex);
if (last && !last->fChased && !last->fLoop) {
last->fChased = true;
- SkASSERT(!SkPathOpsDebug::ChaseContains(chaseArray, last));
+ SkASSERT(!SkPathOpsDebug::ChaseContains(chase, last));
// assert that last isn't already in array
- *chaseArray.append() = last;
+ *chase.append() = last;
+#if DEBUG_WINDING
+ SkDebugf("%s chase.append id=%d windSum=%d small=%d\n", __FUNCTION__,
+ last->fOther->span(last->fOtherIndex).fOther->debugID(), last->fWindSum,
+ last->fSmall);
+#endif
}
}
- SkTDArray<SkOpSpan *>* chaseArrayPtr = &chaseArray;
- current = FindChase(chaseArrayPtr, &index, &endIndex);
+ current = FindChase(&chase, &index, &endIndex);
#if DEBUG_ACTIVE_SPANS
DebugShowActiveSpans(contourList);
#endif
« no previous file with comments | « src/pathops/SkPathOpsPoint.h ('k') | src/pathops/SkPathOpsTriangle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698