summaryrefslogtreecommitdiff
path: root/pathops/SkPathOpsSimplify.cpp
diff options
context:
space:
mode:
authorcaryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-07 18:51:31 +0000
committercaryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-07 18:51:31 +0000
commit2274f123b56c02b1d0f195c6a980e6cfacc239bf (patch)
treed093f30001efc8ba1d88350c8a9a9a26c6a84362 /pathops/SkPathOpsSimplify.cpp
parenta86475502d41567e61f0e0c0dabee88611f8676b (diff)
downloadsrc-2274f123b56c02b1d0f195c6a980e6cfacc239bf.tar.gz
path ops -- fix skp bugs
This fixes a series of bugs discovered by running the small set of Skia skp files through pathops to flatten the clips. Review URL: https://codereview.chromium.org/14798004 git-svn-id: http://skia.googlecode.com/svn/trunk/src@9042 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'pathops/SkPathOpsSimplify.cpp')
-rw-r--r--pathops/SkPathOpsSimplify.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/pathops/SkPathOpsSimplify.cpp b/pathops/SkPathOpsSimplify.cpp
index cb00aff8..9a319e08 100644
--- a/pathops/SkPathOpsSimplify.cpp
+++ b/pathops/SkPathOpsSimplify.cpp
@@ -32,11 +32,15 @@ static bool bridgeWinding(SkTDArray<SkOpContour*>& contourList, SkPathWriter* si
do {
if (current->activeWinding(index, endIndex)) {
do {
- #if DEBUG_ACTIVE_SPANS
if (!unsortable && current->done()) {
+ #if DEBUG_ACTIVE_SPANS
DebugShowActiveSpans(contourList);
- }
#endif
+ if (simple->isEmpty()) {
+ simple->init();
+ break;
+ }
+ }
SkASSERT(unsortable || !current->done());
int nextStart = index;
int nextEnd = endIndex;
@@ -63,7 +67,7 @@ static bool bridgeWinding(SkTDArray<SkOpContour*>& contourList, SkPathWriter* si
} while (!simple->isClosed() && (!unsortable
|| !current->done(SkMin32(index, endIndex))));
if (current->activeWinding(index, endIndex) && !simple->isClosed()) {
- SkASSERT(unsortable);
+ SkASSERT(unsortable || simple->isEmpty());
int min = SkMin32(index, endIndex);
if (!current->done(min)) {
current->addCurveTo(index, endIndex, simple, true);
@@ -182,7 +186,7 @@ bool Simplify(const SkPath& path, SkPath* result) {
CoincidenceCheck(&contourList, 0);
FixOtherTIndex(&contourList);
SortSegments(&contourList);
-#if DEBUG_ACTIVE_SPANS
+#if DEBUG_ACTIVE_SPANS || DEBUG_ACTIVE_SPANS_FIRST_ONLY
DebugShowActiveSpans(contourList);
#endif
// construct closed contours