OLD | NEW |
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 "SkIntersections.h" | 7 #include "SkIntersections.h" |
8 #include "SkOpAngle.h" | 8 #include "SkOpAngle.h" |
9 #include "SkOpSegment.h" | 9 #include "SkOpSegment.h" |
10 #include "SkPathOpsCurve.h" | 10 #include "SkPathOpsCurve.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return COMPARE_RESULT("5 y_ry == 0 && y + ry < 0", y < 0); | 101 return COMPARE_RESULT("5 y_ry == 0 && y + ry < 0", y < 0); |
102 } | 102 } |
103 if (y + ry > 0) { // if a y is greater than zero and an x is positive,
non zero is smaller | 103 if (y + ry > 0) { // if a y is greater than zero and an x is positive,
non zero is smaller |
104 return COMPARE_RESULT("6 y_ry == 0 && y + ry > 0", (x + rx > 0) ^ (y
== 0)); | 104 return COMPARE_RESULT("6 y_ry == 0 && y + ry > 0", (x + rx > 0) ^ (y
== 0)); |
105 } | 105 } |
106 // at this point, both y's are zero, so lines are coincident or one is d
egenerate | 106 // at this point, both y's are zero, so lines are coincident or one is d
egenerate |
107 SkASSERT(x * rx != 0); // and a degenerate line should haven't gotten t
his far | 107 SkASSERT(x * rx != 0); // and a degenerate line should haven't gotten t
his far |
108 } | 108 } |
109 // see if either curve can be lengthened before trying the tangent | 109 // see if either curve can be lengthened before trying the tangent |
110 if (fSegment->other(fEnd) != rh.fSegment // tangents not absolutely identic
al | 110 if (fSegment->other(fEnd) != rh.fSegment // tangents not absolutely identic
al |
111 && rh.fSegment->other(rh.fEnd) != fSegment) { // and not intersecti
ng | 111 && rh.fSegment->other(rh.fEnd) != fSegment |
| 112 && y != -DBL_EPSILON |
| 113 && ry != -DBL_EPSILON) { // and not intersecting |
112 SkOpAngle longer = *this; | 114 SkOpAngle longer = *this; |
113 SkOpAngle rhLonger = rh; | 115 SkOpAngle rhLonger = rh; |
114 if ((longer.lengthen(rh) | rhLonger.lengthen(*this)) // lengthen both | 116 if ((longer.lengthen(rh) | rhLonger.lengthen(*this)) // lengthen both |
115 && (fUnorderable || !longer.fUnorderable) | 117 && (fUnorderable || !longer.fUnorderable) |
116 && (rh.fUnorderable || !rhLonger.fUnorderable)) { | 118 && (rh.fUnorderable || !rhLonger.fUnorderable)) { |
117 #if DEBUG_ANGLE | 119 #if DEBUG_ANGLE |
118 bugOut.prepend(" "); | 120 bugOut.prepend(" "); |
119 #endif | 121 #endif |
120 return COMPARE_RESULT("10 longer.lengthen(rh) ...", longer < rhLonge
r); | 122 return COMPARE_RESULT("10 longer.lengthen(rh) ...", longer < rhLonge
r); |
121 } | 123 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 const SkOpSpan& spanMin = fStart < fEnd ? spanStart : spanEnd; | 426 const SkOpSpan& spanMin = fStart < fEnd ? spanStart : spanEnd; |
425 SkDebugf("id=%d (%1.9g,%1.9g) start=%d (%1.9g) end=%d (%1.9g) sumWind=", | 427 SkDebugf("id=%d (%1.9g,%1.9g) start=%d (%1.9g) end=%d (%1.9g) sumWind=", |
426 fSegment->debugID(), fSegment->xAtT(fStart), fSegment->yAtT(fStart), | 428 fSegment->debugID(), fSegment->xAtT(fStart), fSegment->yAtT(fStart), |
427 fStart, spanStart.fT, fEnd, spanEnd.fT); | 429 fStart, spanStart.fT, fEnd, spanEnd.fT); |
428 SkPathOpsDebug::WindingPrintf(spanMin.fWindSum); | 430 SkPathOpsDebug::WindingPrintf(spanMin.fWindSum); |
429 SkDebugf(" oppWind="); | 431 SkDebugf(" oppWind="); |
430 SkPathOpsDebug::WindingPrintf(spanMin.fOppSum), | 432 SkPathOpsDebug::WindingPrintf(spanMin.fOppSum), |
431 SkDebugf(" done=%d\n", spanMin.fDone); | 433 SkDebugf(" done=%d\n", spanMin.fDone); |
432 } | 434 } |
433 #endif | 435 #endif |
OLD | NEW |