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

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

Issue 2103863005: fix another pathops fuzz bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | src/pathops/SkPathOpsOp.cpp » ('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 "SkOpCoincidence.h" 8 #include "SkOpCoincidence.h"
9 #include "SkOpEdgeBuilder.h" 9 #include "SkOpEdgeBuilder.h"
10 #include "SkPathOpsCommon.h" 10 #include "SkPathOpsCommon.h"
11 #include "SkPathWriter.h" 11 #include "SkPathWriter.h"
12 #include "SkTSort.h" 12 #include "SkTSort.h"
13 13
14 const SkOpAngle* AngleWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* windi ngPtr, 14 const SkOpAngle* AngleWinding(SkOpSpanBase* start, SkOpSpanBase* end, int* windi ngPtr,
15 bool* sortablePtr) { 15 bool* sortablePtr) {
16 // find first angle, initialize winding to computed fWindSum 16 // find first angle, initialize winding to computed fWindSum
17 SkOpSegment* segment = start->segment(); 17 SkOpSegment* segment = start->segment();
18 const SkOpAngle* angle = segment->spanToAngle(start, end); 18 const SkOpAngle* angle = segment->spanToAngle(start, end);
19 if (!angle) { 19 if (!angle) {
20 *windingPtr = SK_MinS32; 20 *windingPtr = SK_MinS32;
21 return nullptr; 21 return nullptr;
22 } 22 }
23 bool computeWinding = false; 23 bool computeWinding = false;
24 const SkOpAngle* firstAngle = angle; 24 const SkOpAngle* firstAngle = angle;
25 bool loop = false; 25 bool loop = false;
26 bool unorderable = false; 26 bool unorderable = false;
27 int winding = SK_MinS32; 27 int winding = SK_MinS32;
28 do { 28 do {
29 angle = angle->next(); 29 angle = angle->next();
30 if (!angle) {
31 return nullptr;
32 }
30 unorderable |= angle->unorderable(); 33 unorderable |= angle->unorderable();
31 if ((computeWinding = unorderable || (angle == firstAngle && loop))) { 34 if ((computeWinding = unorderable || (angle == firstAngle && loop))) {
32 break; // if we get here, there's no winding, loop is unorderable 35 break; // if we get here, there's no winding, loop is unorderable
33 } 36 }
34 loop |= angle == firstAngle; 37 loop |= angle == firstAngle;
35 segment = angle->segment(); 38 segment = angle->segment();
36 winding = segment->windSum(angle); 39 winding = segment->windSum(angle);
37 } while (winding == SK_MinS32); 40 } while (winding == SK_MinS32);
38 // if the angle loop contains an unorderable span, the angle order may be us eless 41 // if the angle loop contains an unorderable span, the angle order may be us eless
39 // directly compute the winding in this case for each span 42 // directly compute the winding in this case for each span
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 if (!coincidence->apply()) { 539 if (!coincidence->apply()) {
537 return false; 540 return false;
538 } 541 }
539 } 542 }
540 #if DEBUG_ACTIVE_SPANS 543 #if DEBUG_ACTIVE_SPANS
541 coincidence->debugShowCoincidence(); 544 coincidence->debugShowCoincidence();
542 DebugShowActiveSpans(contourList); 545 DebugShowActiveSpans(contourList);
543 #endif 546 #endif
544 return true; 547 return true;
545 } 548 }
OLDNEW
« no previous file with comments | « no previous file | src/pathops/SkPathOpsOp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698