| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |