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 | 7 |
8 #include "SkIntersections.h" | 8 #include "SkIntersections.h" |
9 #include "SkPathOpsCubic.h" | 9 #include "SkPathOpsCubic.h" |
10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 SkReduceOrder s2; | 102 SkReduceOrder s2; |
103 int o2 = quadPart(cubic2, t2Start, t2, &s2); | 103 int o2 = quadPart(cubic2, t2Start, t2, &s2); |
104 #if ONE_OFF_DEBUG | 104 #if ONE_OFF_DEBUG |
105 char tab[] = " "; | 105 char tab[] = " "; |
106 if (tLimits1[0][0] >= t1Start && tLimits1[0][1] <= t1 | 106 if (tLimits1[0][0] >= t1Start && tLimits1[0][1] <= t1 |
107 && tLimits1[1][0] >= t2Start && tLimits1[1][1] <= t2) { | 107 && tLimits1[1][0] >= t2Start && tLimits1[1][1] <= t2) { |
108 SkDebugf("%.*s %s t1=(%1.9g,%1.9g) t2=(%1.9g,%1.9g)", i.depth()*
2, tab, | 108 SkDebugf("%.*s %s t1=(%1.9g,%1.9g) t2=(%1.9g,%1.9g)", i.depth()*
2, tab, |
109 __FUNCTION__, t1Start, t1, t2Start, t2); | 109 __FUNCTION__, t1Start, t1, t2Start, t2); |
110 SkIntersections xlocals; | 110 SkIntersections xlocals; |
| 111 xlocals.allowNear(false); |
111 intersectWithOrder(s1.fQuad, o1, s2.fQuad, o2, xlocals); | 112 intersectWithOrder(s1.fQuad, o1, s2.fQuad, o2, xlocals); |
112 SkDebugf(" xlocals.fUsed=%d\n", xlocals.used()); | 113 SkDebugf(" xlocals.fUsed=%d\n", xlocals.used()); |
113 } | 114 } |
114 #endif | 115 #endif |
115 SkIntersections locals; | 116 SkIntersections locals; |
| 117 locals.allowNear(false); |
116 intersectWithOrder(s1.fQuad, o1, s2.fQuad, o2, locals); | 118 intersectWithOrder(s1.fQuad, o1, s2.fQuad, o2, locals); |
117 int tCount = locals.used(); | 119 int tCount = locals.used(); |
118 for (int tIdx = 0; tIdx < tCount; ++tIdx) { | 120 for (int tIdx = 0; tIdx < tCount; ++tIdx) { |
119 double to1 = t1Start + (t1 - t1Start) * locals[0][tIdx]; | 121 double to1 = t1Start + (t1 - t1Start) * locals[0][tIdx]; |
120 double to2 = t2Start + (t2 - t2Start) * locals[1][tIdx]; | 122 double to2 = t2Start + (t2 - t2Start) * locals[1][tIdx]; |
121 // if the computed t is not sufficiently precise, iterate | 123 // if the computed t is not sufficiently precise, iterate |
122 SkDPoint p1 = cubic1.ptAtT(to1); | 124 SkDPoint p1 = cubic1.ptAtT(to1); |
123 SkDPoint p2 = cubic2.ptAtT(to2); | 125 SkDPoint p2 = cubic2.ptAtT(to2); |
124 if (p1.approximatelyEqual(p2)) { | 126 if (p1.approximatelyEqual(p2)) { |
125 SkASSERT(!locals.isCoincident(tIdx)); | 127 SkASSERT(!locals.isCoincident(tIdx)); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 541 } |
540 (void) intersect(c, c); | 542 (void) intersect(c, c); |
541 if (used() > 0) { | 543 if (used() > 0) { |
542 SkASSERT(used() == 1); | 544 SkASSERT(used() == 1); |
543 if (fT[0][0] > fT[1][0]) { | 545 if (fT[0][0] > fT[1][0]) { |
544 swapPts(); | 546 swapPts(); |
545 } | 547 } |
546 } | 548 } |
547 return used(); | 549 return used(); |
548 } | 550 } |
OLD | NEW |