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

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

Issue 131103009: update pathops to circle sort (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: disable old test that still fails on linux 32 release 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/SkPathOpsQuad.cpp ('k') | src/pathops/SkPathOpsTypes.h » ('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"
(...skipping 15 matching lines...) Expand all
26 topLeft.fX = topLeft.fY = SK_ScalarMin; 26 topLeft.fX = topLeft.fY = SK_ScalarMin;
27 continue; 27 continue;
28 } 28 }
29 break; 29 break;
30 } 30 }
31 SkTDArray<SkOpSpan*> chaseArray; 31 SkTDArray<SkOpSpan*> chaseArray;
32 do { 32 do {
33 if (current->activeWinding(index, endIndex)) { 33 if (current->activeWinding(index, endIndex)) {
34 do { 34 do {
35 if (!unsortable && current->done()) { 35 if (!unsortable && current->done()) {
36 #if DEBUG_ACTIVE_SPANS
37 DebugShowActiveSpans(contourList);
38 #endif
39 if (simple->isEmpty()) { 36 if (simple->isEmpty()) {
40 simple->init(); 37 simple->init();
41 break; 38 break;
42 } 39 }
43 } 40 }
44 SkASSERT(unsortable || !current->done()); 41 SkASSERT(unsortable || !current->done());
45 int nextStart = index; 42 int nextStart = index;
46 int nextEnd = endIndex; 43 int nextEnd = endIndex;
47 SkOpSegment* next = current->findNextWinding(&chaseArray, &n extStart, &nextEnd, 44 SkOpSegment* next = current->findNextWinding(&chaseArray, &n extStart, &nextEnd,
48 &unsortable); 45 &unsortable);
(...skipping 21 matching lines...) Expand all
70 SkASSERT(unsortable || simple->isEmpty()); 67 SkASSERT(unsortable || simple->isEmpty());
71 int min = SkMin32(index, endIndex); 68 int min = SkMin32(index, endIndex);
72 if (!current->done(min)) { 69 if (!current->done(min)) {
73 current->addCurveTo(index, endIndex, simple, true); 70 current->addCurveTo(index, endIndex, simple, true);
74 current->markDoneUnary(min); 71 current->markDoneUnary(min);
75 } 72 }
76 } 73 }
77 simple->close(); 74 simple->close();
78 } else { 75 } else {
79 SkOpSpan* last = current->markAndChaseDoneUnary(index, endIndex) ; 76 SkOpSpan* last = current->markAndChaseDoneUnary(index, endIndex) ;
80 if (last && !last->fLoop) { 77 if (last && !last->fChased && !last->fLoop) {
78 last->fChased = true;
79 SkASSERT(!SkPathOpsDebug::ChaseContains(chaseArray, last));
80 // assert that last isn't already in array
81 *chaseArray.append() = last; 81 *chaseArray.append() = last;
82 } 82 }
83 } 83 }
84 current = FindChase(chaseArray, index, endIndex); 84 SkTDArray<SkOpSpan *>* chaseArrayPtr = &chaseArray;
85 current = FindChase(chaseArrayPtr, &index, &endIndex);
85 #if DEBUG_ACTIVE_SPANS 86 #if DEBUG_ACTIVE_SPANS
86 DebugShowActiveSpans(contourList); 87 DebugShowActiveSpans(contourList);
87 #endif 88 #endif
88 if (!current) { 89 if (!current) {
89 break; 90 break;
90 } 91 }
91 } while (true); 92 } while (true);
92 } while (true); 93 } while (true);
93 return simple->someAssemblyRequired(); 94 return simple->someAssemblyRequired();
94 } 95 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 SkOpContour** nextPtr = currentPtr; 176 SkOpContour** nextPtr = currentPtr;
176 SkOpContour* current = *currentPtr++; 177 SkOpContour* current = *currentPtr++;
177 if (current->containsCubics()) { 178 if (current->containsCubics()) {
178 AddSelfIntersectTs(current); 179 AddSelfIntersectTs(current);
179 } 180 }
180 SkOpContour* next; 181 SkOpContour* next;
181 do { 182 do {
182 next = *nextPtr++; 183 next = *nextPtr++;
183 } while (AddIntersectTs(current, next) && nextPtr != listEnd); 184 } while (AddIntersectTs(current, next) && nextPtr != listEnd);
184 } while (currentPtr != listEnd); 185 } while (currentPtr != listEnd);
185 HandleCoincidence(&contourList, 0); 186 if (!HandleCoincidence(&contourList, 0)) {
187 return false;
188 }
186 // construct closed contours 189 // construct closed contours
187 SkPathWriter simple(*result); 190 SkPathWriter simple(*result);
188 if (builder.xorMask() == kWinding_PathOpsMask ? bridgeWinding(contourList, & simple) 191 if (builder.xorMask() == kWinding_PathOpsMask ? bridgeWinding(contourList, & simple)
189 : !bridgeXor(contourList, &simple)) 192 : !bridgeXor(contourList, &simple))
190 { // if some edges could not be resolved, assemble remaining fragments 193 { // if some edges could not be resolved, assemble remaining fragments
191 SkPath temp; 194 SkPath temp;
192 temp.setFillType(fillType); 195 temp.setFillType(fillType);
193 SkPathWriter assembled(temp); 196 SkPathWriter assembled(temp);
194 Assemble(simple, &assembled); 197 Assemble(simple, &assembled);
195 *result = *assembled.nativePath(); 198 *result = *assembled.nativePath();
196 result->setFillType(fillType); 199 result->setFillType(fillType);
197 } 200 }
198 return true; 201 return true;
199 } 202 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsQuad.cpp ('k') | src/pathops/SkPathOpsTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698