OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkChunkAlloc.h" | 8 #include "SkChunkAlloc.h" |
9 #include "SkPathOpsBounds.h" | 9 #include "SkPathOpsBounds.h" |
10 #include "SkPathOpsRect.h" | 10 #include "SkPathOpsRect.h" |
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 double tStep = tEnd - tStart; | 1460 double tStep = tEnd - tStart; |
1461 SkDPoint workPt; | 1461 SkDPoint workPt; |
1462 do { | 1462 do { |
1463 tStep *= 0.5; | 1463 tStep *= 0.5; |
1464 if (precisely_zero(tStep)) { | 1464 if (precisely_zero(tStep)) { |
1465 return 0; | 1465 return 0; |
1466 } | 1466 } |
1467 workT += tStep; | 1467 workT += tStep; |
1468 workPt = fCurve.ptAtT(workT); | 1468 workPt = fCurve.ptAtT(workT); |
1469 coinW.setPerp(fCurve, workT, workPt, opp->fCurve); | 1469 coinW.setPerp(fCurve, workT, workPt, opp->fCurve); |
| 1470 if (coinW.perpT() < 0) { |
| 1471 continue; |
| 1472 } |
1470 SkDVector perpW = workPt - coinW.perpPt(); | 1473 SkDVector perpW = workPt - coinW.perpPt(); |
1471 if ((perpS.dot(perpW) >= 0) == (tStep < 0)) { | 1474 if ((perpS.dot(perpW) >= 0) == (tStep < 0)) { |
1472 tStep = -tStep; | 1475 tStep = -tStep; |
1473 } | 1476 } |
1474 } while (!workPt.approximatelyEqual(coinW.perpPt())); | 1477 if (workPt.approximatelyEqual(coinW.perpPt())) { |
| 1478 break; |
| 1479 } |
| 1480 } while (true); |
1475 double oppTTest = coinW.perpT(); | 1481 double oppTTest = coinW.perpT(); |
1476 if (!opp->fHead->contains(oppTTest)) { | 1482 if (!opp->fHead->contains(oppTTest)) { |
1477 return 0; | 1483 return 0; |
1478 } | 1484 } |
1479 i->setMax(1); | 1485 i->setMax(1); |
1480 i->insert(workT, oppTTest, workPt); | 1486 i->insert(workT, oppTTest, workPt); |
1481 return 1; | 1487 return 1; |
1482 } | 1488 } |
1483 | 1489 |
1484 | 1490 |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2228 } else if (intersections->isCoincident(index + 1)) { | 2234 } else if (intersections->isCoincident(index + 1)) { |
2229 intersections->removeOne(index + 1); | 2235 intersections->removeOne(index + 1); |
2230 --last; | 2236 --last; |
2231 } else { | 2237 } else { |
2232 intersections->setCoincident(index++); | 2238 intersections->setCoincident(index++); |
2233 } | 2239 } |
2234 intersections->setCoincident(index); | 2240 intersections->setCoincident(index); |
2235 } | 2241 } |
2236 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); | 2242 SkASSERT(intersections->used() <= TCurve::kMaxIntersections); |
2237 } | 2243 } |
OLD | NEW |