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

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

Issue 239563004: fix minor skp-found bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix mac-detected errors Created 6 years, 8 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/SkPathOpsOp.cpp ('k') | src/pathops/SkReduceOrder.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 "SkOpEdgeBuilder.h" 8 #include "SkOpEdgeBuilder.h"
9 #include "SkPathOpsCommon.h" 9 #include "SkPathOpsCommon.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
11 11
12 static bool bridgeWinding(SkTArray<SkOpContour*, true>& contourList, SkPathWrite r* simple) { 12 static bool bridgeWinding(SkTArray<SkOpContour*, true>& contourList, SkPathWrite r* simple) {
13 bool firstContour = true; 13 bool firstContour = true;
14 bool unsortable = false; 14 bool unsortable = false;
15 bool topUnsortable = false; 15 bool topUnsortable = false;
16 bool firstPass = true;
17 SkPoint lastTopLeft;
16 SkPoint topLeft = {SK_ScalarMin, SK_ScalarMin}; 18 SkPoint topLeft = {SK_ScalarMin, SK_ScalarMin};
17 do { 19 do {
18 int index, endIndex; 20 int index, endIndex;
19 bool topDone; 21 bool topDone;
22 lastTopLeft = topLeft;
20 SkOpSegment* current = FindSortableTop(contourList, SkOpAngle::kUnaryWin ding, &firstContour, 23 SkOpSegment* current = FindSortableTop(contourList, SkOpAngle::kUnaryWin ding, &firstContour,
21 &index, &endIndex, &topLeft, &topUnsortable, &topDone); 24 &index, &endIndex, &topLeft, &topUnsortable, &topDone, firstPass );
22 if (!current) { 25 if (!current) {
23 if (topUnsortable || !topDone) { 26 if ((!topUnsortable || firstPass) && !topDone) {
24 topUnsortable = false;
25 SkASSERT(topLeft.fX != SK_ScalarMin && topLeft.fY != SK_ScalarMi n); 27 SkASSERT(topLeft.fX != SK_ScalarMin && topLeft.fY != SK_ScalarMi n);
26 topLeft.fX = topLeft.fY = SK_ScalarMin; 28 topLeft.fX = topLeft.fY = SK_ScalarMin;
27 continue; 29 continue;
28 } 30 }
29 break; 31 break;
30 } 32 }
33 firstPass = !topUnsortable || lastTopLeft != topLeft;
31 SkTDArray<SkOpSpan*> chaseArray; 34 SkTDArray<SkOpSpan*> chaseArray;
32 do { 35 do {
33 if (current->activeWinding(index, endIndex)) { 36 if (current->activeWinding(index, endIndex)) {
34 do { 37 do {
35 if (!unsortable && current->done()) { 38 if (!unsortable && current->done()) {
36 if (simple->isEmpty()) { 39 if (simple->isEmpty()) {
37 simple->init(); 40 simple->init();
38 break; 41 break;
39 } 42 }
40 } 43 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 { // if some edges could not be resolved, assemble remaining fragments 196 { // if some edges could not be resolved, assemble remaining fragments
194 SkPath temp; 197 SkPath temp;
195 temp.setFillType(fillType); 198 temp.setFillType(fillType);
196 SkPathWriter assembled(temp); 199 SkPathWriter assembled(temp);
197 Assemble(simple, &assembled); 200 Assemble(simple, &assembled);
198 *result = *assembled.nativePath(); 201 *result = *assembled.nativePath();
199 result->setFillType(fillType); 202 result->setFillType(fillType);
200 } 203 }
201 return true; 204 return true;
202 } 205 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsOp.cpp ('k') | src/pathops/SkReduceOrder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698