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

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

Issue 15338003: path ops -- rewrite angle sort (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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/SkPathOpsDebug.cpp ('k') | src/pathops/SkPathOpsPoint.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 19 matching lines...) Expand all
30 *chase.insert(0) = span; 30 *chase.insert(0) = span;
31 #else 31 #else
32 *chase.append() = span; 32 *chase.append() = span;
33 #endif 33 #endif
34 return last->segment(); 34 return last->segment();
35 } 35 }
36 if (done == angles.count()) { 36 if (done == angles.count()) {
37 continue; 37 continue;
38 } 38 }
39 SkTDArray<SkOpAngle*> sorted; 39 SkTDArray<SkOpAngle*> sorted;
40 bool sortable = SkOpSegment::SortAngles(angles, &sorted); 40 bool sortable = SkOpSegment::SortAngles(angles, &sorted,
41 SkOpSegment::kMayBeUnordered_SortAngleKind);
41 int angleCount = sorted.count(); 42 int angleCount = sorted.count();
42 #if DEBUG_SORT 43 #if DEBUG_SORT
43 sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0); 44 sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0);
44 #endif 45 #endif
45 if (!sortable) { 46 if (!sortable) {
46 continue; 47 continue;
47 } 48 }
48 // find first angle, initialize winding to computed fWindSum 49 // find first angle, initialize winding to computed fWindSum
49 int firstIndex = -1; 50 int firstIndex = -1;
50 const SkOpAngle* angle; 51 const SkOpAngle* angle;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 static const bool gOutInverse[kReverseDifference_PathOp + 1][2][2] = { 226 static const bool gOutInverse[kReverseDifference_PathOp + 1][2][2] = {
226 {{ false, false }, { true, false }}, // diff 227 {{ false, false }, { true, false }}, // diff
227 {{ false, false }, { false, true }}, // sect 228 {{ false, false }, { false, true }}, // sect
228 {{ false, true }, { true, true }}, // union 229 {{ false, true }, { true, true }}, // union
229 {{ false, true }, { true, false }}, // xor 230 {{ false, true }, { true, false }}, // xor
230 {{ false, true }, { false, false }}, // rev diff 231 {{ false, true }, { false, false }}, // rev diff
231 }; 232 };
232 233
233 bool Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result) { 234 bool Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result) {
234 #if DEBUG_SHOW_PATH 235 #if DEBUG_SHOW_PATH
236 ShowFunctionHeader();
235 ShowPath(one, "path"); 237 ShowPath(one, "path");
236 ShowPath(two, "pathB"); 238 ShowPath(two, "pathB");
237 ShowOp(op, "path", "pathB"); 239 ShowOp(op, "path", "pathB");
238 #endif 240 #endif
239 op = gOpInverse[op][one.isInverseFillType()][two.isInverseFillType()]; 241 op = gOpInverse[op][one.isInverseFillType()][two.isInverseFillType()];
240 SkPath::FillType fillType = gOutInverse[op][one.isInverseFillType()][two.isI nverseFillType()] 242 SkPath::FillType fillType = gOutInverse[op][one.isInverseFillType()][two.isI nverseFillType()]
241 ? SkPath::kInverseEvenOdd_FillType : SkPath::kEvenOdd_FillType; 243 ? SkPath::kInverseEvenOdd_FillType : SkPath::kEvenOdd_FillType;
242 const SkPath* minuend = &one; 244 const SkPath* minuend = &one;
243 const SkPath* subtrahend = &two; 245 const SkPath* subtrahend = &two;
244 if (op == kReverseDifference_PathOp) { 246 if (op == kReverseDifference_PathOp) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 { // if some edges could not be resolved, assemble remaining fragments 308 { // if some edges could not be resolved, assemble remaining fragments
307 SkPath temp; 309 SkPath temp;
308 temp.setFillType(fillType); 310 temp.setFillType(fillType);
309 SkPathWriter assembled(temp); 311 SkPathWriter assembled(temp);
310 Assemble(wrapper, &assembled); 312 Assemble(wrapper, &assembled);
311 *result = *assembled.nativePath(); 313 *result = *assembled.nativePath();
312 result->setFillType(fillType); 314 result->setFillType(fillType);
313 } 315 }
314 return true; 316 return true;
315 } 317 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsDebug.cpp ('k') | src/pathops/SkPathOpsPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698