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

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

Issue 2274803003: add pathops debugging (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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/SkOpSegment.h ('k') | src/pathops/SkOpSpan.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 "SkOpCoincidence.h" 7 #include "SkOpCoincidence.h"
8 #include "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkOpSegment.h" 9 #include "SkOpSegment.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
11 11
12 #define FAIL_IF(cond) do { if (cond) return false; } while (false)
13
14 /* 12 /*
15 After computing raw intersections, post process all segments to: 13 After computing raw intersections, post process all segments to:
16 - find small collections of points that can be collapsed to a single point 14 - find small collections of points that can be collapsed to a single point
17 - find missing intersections to resolve differences caused by different algorith ms 15 - find missing intersections to resolve differences caused by different algorith ms
18 16
19 Consider segments containing tiny or small intervals. Consider coincident segmen ts 17 Consider segments containing tiny or small intervals. Consider coincident segmen ts
20 because coincidence finds intersections through distance measurement that non-co incident 18 because coincidence finds intersections through distance measurement that non-co incident
21 intersection tests cannot. 19 intersection tests cannot.
22 */ 20 */
23 21
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 int maxWinding; 154 int maxWinding;
157 setUpWinding(start, end, &maxWinding, sumWinding); 155 setUpWinding(start, end, &maxWinding, sumWinding);
158 bool from = maxWinding != 0; 156 bool from = maxWinding != 0;
159 bool to = *sumWinding != 0; 157 bool to = *sumWinding != 0;
160 bool result = gUnaryActiveEdge[from][to]; 158 bool result = gUnaryActiveEdge[from][to];
161 return result; 159 return result;
162 } 160 }
163 161
164 bool SkOpSegment::addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end, 162 bool SkOpSegment::addCurveTo(const SkOpSpanBase* start, const SkOpSpanBase* end,
165 SkPathWriter* path) const { 163 SkPathWriter* path) const {
166 if (start->starter(end)->alreadyAdded()) { 164 FAIL_IF(start->starter(end)->alreadyAdded());
167 SkDEBUGF(("same curve added twice aborted pathops\n"));
168 return false;
169 }
170 SkOpCurve edge; 165 SkOpCurve edge;
171 const SkPoint* ePtr; 166 const SkPoint* ePtr;
172 SkScalar eWeight; 167 SkScalar eWeight;
173 if ((start == &fHead && end == &fTail) || (start == &fTail && end == &fHead) ) { 168 if ((start == &fHead && end == &fTail) || (start == &fTail && end == &fHead) ) {
174 ePtr = fPts; 169 ePtr = fPts;
175 eWeight = fWeight; 170 eWeight = fWeight;
176 } else { 171 } else {
177 // OPTIMIZE? if not active, skip remainder and return xyAtT(end) 172 // OPTIMIZE? if not active, skip remainder and return xyAtT(end)
178 subDivide(start, end, &edge); 173 subDivide(start, end, &edge);
179 ePtr = edge.fPts; 174 ePtr = edge.fPts;
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 int absOut = SkTAbs(outerWinding); 1785 int absOut = SkTAbs(outerWinding);
1791 int absIn = SkTAbs(innerWinding); 1786 int absIn = SkTAbs(innerWinding);
1792 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; 1787 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn;
1793 return result; 1788 return result;
1794 } 1789 }
1795 1790
1796 int SkOpSegment::windSum(const SkOpAngle* angle) const { 1791 int SkOpSegment::windSum(const SkOpAngle* angle) const {
1797 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); 1792 const SkOpSpan* minSpan = angle->start()->starter(angle->end());
1798 return minSpan->windSum(); 1793 return minSpan->windSum();
1799 } 1794 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpSegment.h ('k') | src/pathops/SkOpSpan.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698