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

Side by Side Diff: src/pathops/SkOpContour.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/SkOpContour.h ('k') | src/pathops/SkOpSegment.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 2013 Google Inc. 2 * Copyright 2013 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 "SkIntersections.h" 7 #include "SkIntersections.h"
8 #include "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkPathWriter.h" 9 #include "SkPathWriter.h"
10 #include "SkTSort.h" 10 #include "SkTSort.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 coincidence.fSegments[1] = otherIndex; 141 coincidence.fSegments[1] = otherIndex;
142 coincidence.fTs[swap][0] = ts[0][ptIndex]; 142 coincidence.fTs[swap][0] = ts[0][ptIndex];
143 coincidence.fTs[swap][1] = ts[0][ptIndex + 1]; 143 coincidence.fTs[swap][1] = ts[0][ptIndex + 1];
144 coincidence.fTs[!swap][0] = ts[1][ptIndex]; 144 coincidence.fTs[!swap][0] = ts[1][ptIndex];
145 coincidence.fTs[!swap][1] = ts[1][ptIndex + 1]; 145 coincidence.fTs[!swap][1] = ts[1][ptIndex + 1];
146 coincidence.fPts[0] = pt0; 146 coincidence.fPts[0] = pt0;
147 coincidence.fPts[1] = pt1; 147 coincidence.fPts[1] = pt1;
148 return true; 148 return true;
149 } 149 }
150 150
151 bool SkOpContour::calcAngles() {
152 int segmentCount = fSegments.count();
153 for (int test = 0; test < segmentCount; ++test) {
154 if (!fSegments[test].calcAngles()) {
155 return false;
156 }
157 }
158 return true;
159 }
160
151 void SkOpContour::calcCoincidentWinding() { 161 void SkOpContour::calcCoincidentWinding() {
152 int count = fCoincidences.count(); 162 int count = fCoincidences.count();
153 #if DEBUG_CONCIDENT 163 #if DEBUG_CONCIDENT
154 if (count > 0) { 164 if (count > 0) {
155 SkDebugf("%s count=%d\n", __FUNCTION__, count); 165 SkDebugf("%s count=%d\n", __FUNCTION__, count);
156 } 166 }
157 #endif 167 #endif
158 for (int index = 0; index < count; ++index) { 168 for (int index = 0; index < count; ++index) {
159 SkCoincidence& coincidence = fCoincidences[index]; 169 SkCoincidence& coincidence = fCoincidences[index];
160 calcCommonCoincidentWinding(coincidence); 170 calcCommonCoincidentWinding(coincidence);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 thisOne.addTCancel(*startPt, *endPt, &other); 280 thisOne.addTCancel(*startPt, *endPt, &other);
271 } else { 281 } else {
272 thisOne.addTCoincident(*startPt, *endPt, endT, &other); 282 thisOne.addTCoincident(*startPt, *endPt, endT, &other);
273 } 283 }
274 #if DEBUG_CONCIDENT 284 #if DEBUG_CONCIDENT
275 thisOne.debugShowTs("p"); 285 thisOne.debugShowTs("p");
276 other.debugShowTs("o"); 286 other.debugShowTs("o");
277 #endif 287 #endif
278 } 288 }
279 289
290 void SkOpContour::sortAngles() {
291 int segmentCount = fSegments.count();
292 for (int test = 0; test < segmentCount; ++test) {
293 fSegments[test].sortAngles();
294 }
295 }
296
280 void SkOpContour::sortSegments() { 297 void SkOpContour::sortSegments() {
281 int segmentCount = fSegments.count(); 298 int segmentCount = fSegments.count();
282 fSortedSegments.push_back_n(segmentCount); 299 fSortedSegments.push_back_n(segmentCount);
283 for (int test = 0; test < segmentCount; ++test) { 300 for (int test = 0; test < segmentCount; ++test) {
284 fSortedSegments[test] = &fSegments[test]; 301 fSortedSegments[test] = &fSegments[test];
285 } 302 }
286 SkTQSort<SkOpSegment>(fSortedSegments.begin(), fSortedSegments.end() - 1); 303 SkTQSort<SkOpSegment>(fSortedSegments.begin(), fSortedSegments.end() - 1);
287 fFirstSorted = 0; 304 fFirstSorted = 0;
288 } 305 }
289 306
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 SkDebugf("%s empty contour\n", __FUNCTION__); 396 SkDebugf("%s empty contour\n", __FUNCTION__);
380 SkASSERT(0); 397 SkASSERT(0);
381 // FIXME: delete empty contour? 398 // FIXME: delete empty contour?
382 return; 399 return;
383 } 400 }
384 fBounds = fSegments.front().bounds(); 401 fBounds = fSegments.front().bounds();
385 for (int index = 1; index < count; ++index) { 402 for (int index = 1; index < count; ++index) {
386 fBounds.add(fSegments[index].bounds()); 403 fBounds.add(fSegments[index].bounds());
387 } 404 }
388 } 405 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpContour.h ('k') | src/pathops/SkOpSegment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698