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

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

Issue 633393002: harden pathops for pathological test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: exclude new test that asserts in debug Created 6 years, 1 month 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"
11 11
12 bool SkOpContour::addCoincident(int index, SkOpContour* other, int otherIndex, 12 bool SkOpContour::addCoincident(int index, SkOpContour* other, int otherIndex,
13 const SkIntersections& ts, bool swap) { 13 const SkIntersections& ts, bool swap) {
14 SkPoint pt0 = ts.pt(0).asSkPoint(); 14 SkPoint pt0 = ts.pt(0).asSkPoint();
15 SkPoint pt1 = ts.pt(1).asSkPoint(); 15 SkPoint pt1 = ts.pt(1).asSkPoint();
16 if (pt0 == pt1) { 16 if (pt0 == pt1 || ts[0][0] == ts[0][1] || ts[1][0] == ts[1][1]) {
17 // FIXME: one could imagine a case where it would be incorrect to ignore this 17 // FIXME: one could imagine a case where it would be incorrect to ignore this
18 // suppose two self-intersecting cubics overlap to be coincident -- 18 // suppose two self-intersecting cubics overlap to be coincident --
19 // this needs to check that by some measure the t values are far enough apart 19 // this needs to check that by some measure the t values are far enough apart
20 // or needs to check to see if the self-intersection bit was set on the cubic segment 20 // or needs to check to see if the self-intersection bit was set on the cubic segment
21 return false; 21 return false;
22 } 22 }
23 SkCoincidence& coincidence = fCoincidences.push_back(); 23 SkCoincidence& coincidence = fCoincidences.push_back();
24 coincidence.fOther = other; 24 coincidence.fOther = other;
25 coincidence.fSegments[0] = index; 25 coincidence.fSegments[0] = index;
26 coincidence.fSegments[1] = otherIndex; 26 coincidence.fSegments[1] = otherIndex;
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 SkDebugf("%s empty contour\n", __FUNCTION__); 753 SkDebugf("%s empty contour\n", __FUNCTION__);
754 SkASSERT(0); 754 SkASSERT(0);
755 // FIXME: delete empty contour? 755 // FIXME: delete empty contour?
756 return; 756 return;
757 } 757 }
758 fBounds = fSegments.front().bounds(); 758 fBounds = fSegments.front().bounds();
759 for (int index = 1; index < count; ++index) { 759 for (int index = 1; index < count; ++index) {
760 fBounds.add(fSegments[index].bounds()); 760 fBounds.add(fSegments[index].bounds());
761 } 761 }
762 } 762 }
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