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

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

Issue 18058007: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: try try again Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkOpSegment.cpp ('k') | src/pathops/SkPathOpsDebug.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 "SkOpEdgeBuilder.h" 7 #include "SkOpEdgeBuilder.h"
8 #include "SkPathOpsCommon.h" 8 #include "SkPathOpsCommon.h"
9 #include "SkPathWriter.h" 9 #include "SkPathWriter.h"
10 #include "SkTSort.h" 10 #include "SkTSort.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return last->segment(); 131 return last->segment();
132 } 132 }
133 if (done == angles.count()) { 133 if (done == angles.count()) {
134 continue; 134 continue;
135 } 135 }
136 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted; 136 SkSTArray<SkOpAngle::kStackBasedCount, SkOpAngle*, true> sorted;
137 bool sortable = SkOpSegment::SortAngles(angles, &sorted, 137 bool sortable = SkOpSegment::SortAngles(angles, &sorted,
138 SkOpSegment::kMayBeUnordered_SortAngleKind); 138 SkOpSegment::kMayBeUnordered_SortAngleKind);
139 int angleCount = sorted.count(); 139 int angleCount = sorted.count();
140 #if DEBUG_SORT 140 #if DEBUG_SORT
141 sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0, 0); 141 sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0, 0, sorta ble);
142 #endif 142 #endif
143 if (!sortable) { 143 if (!sortable) {
144 continue; 144 continue;
145 } 145 }
146 // find first angle, initialize winding to computed fWindSum 146 // find first angle, initialize winding to computed fWindSum
147 int firstIndex = -1; 147 int firstIndex = -1;
148 const SkOpAngle* angle; 148 const SkOpAngle* angle;
149 int winding; 149 int winding;
150 do { 150 do {
151 angle = sorted[++firstIndex]; 151 angle = sorted[++firstIndex];
152 segment = angle->segment(); 152 segment = angle->segment();
153 winding = segment->windSum(angle); 153 winding = segment->windSum(angle);
154 } while (winding == SK_MinS32); 154 } while (winding == SK_MinS32);
155 int spanWinding = segment->spanSign(angle->start(), angle->end()); 155 int spanWinding = segment->spanSign(angle->start(), angle->end());
156 #if DEBUG_WINDING 156 #if DEBUG_WINDING
157 SkDebugf("%s winding=%d spanWinding=%d\n", 157 SkDebugf("%s winding=%d spanWinding=%d\n",
158 __FUNCTION__, winding, spanWinding); 158 __FUNCTION__, winding, spanWinding);
159 #endif 159 #endif
160 // turn span winding into contour winding 160 // turn span winding into contour winding
161 if (spanWinding * winding < 0) { 161 if (spanWinding * winding < 0) {
162 winding += spanWinding; 162 winding += spanWinding;
163 } 163 }
164 #if DEBUG_SORT 164 #if DEBUG_SORT
165 segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding, 0); 165 segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding, 0, sor table);
166 #endif 166 #endif
167 // we care about first sign and whether wind sum indicates this 167 // we care about first sign and whether wind sum indicates this
168 // edge is inside or outside. Maybe need to pass span winding 168 // edge is inside or outside. Maybe need to pass span winding
169 // or first winding or something into this function? 169 // or first winding or something into this function?
170 // advance to first undone angle, then return it and winding 170 // advance to first undone angle, then return it and winding
171 // (to set whether edges are active or not) 171 // (to set whether edges are active or not)
172 int nextIndex = firstIndex + 1; 172 int nextIndex = firstIndex + 1;
173 int lastIndex = firstIndex != 0 ? firstIndex : angleCount; 173 int lastIndex = firstIndex != 0 ? firstIndex : angleCount;
174 angle = sorted[firstIndex]; 174 angle = sorted[firstIndex];
175 winding -= angle->segment()->spanSign(angle); 175 winding -= angle->segment()->spanSign(angle);
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 } 575 }
576 } 576 }
577 } while (rIndex < count); 577 } while (rIndex < count);
578 #if DEBUG_ASSEMBLE 578 #if DEBUG_ASSEMBLE
579 for (rIndex = 0; rIndex < count; ++rIndex) { 579 for (rIndex = 0; rIndex < count; ++rIndex) {
580 SkASSERT(sLink[rIndex] == SK_MaxS32); 580 SkASSERT(sLink[rIndex] == SK_MaxS32);
581 SkASSERT(eLink[rIndex] == SK_MaxS32); 581 SkASSERT(eLink[rIndex] == SK_MaxS32);
582 } 582 }
583 #endif 583 #endif
584 } 584 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpSegment.cpp ('k') | src/pathops/SkPathOpsDebug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698