diff options
author | 2016-09-15 07:48:18 -0700 | |
---|---|---|
committer | 2016-09-15 07:48:18 -0700 | |
commit | e839e78443e48d4ccad89059b4bc4b3d894fcfdd (patch) | |
tree | 516e3a08710bdbe9dc4785553026f06f14c75e61 /src/pathops/SkPathOpsCurve.cpp | |
parent | 32d1e95ca593adfaa12bc48d4ac0d5501a4b2046 (diff) |
quad and conic do not intersect
If a quad a conic intersect only where the end of one
is contained by the convex hull of the other, and the
curve contained by the hull is nearly a straight line,
treating it as a line may move the end point to the
other side of the curve.
Detect this by checking to see if the end point is in
the hull, and if so, continue to subdivide the curve
rather than treating it as a line.
This fixes several existing tests that were disabled
earlier this year.
A typo in SkDCurve::nearPoint() prevented detecting when
the end of a line was nearly touching a curve.
Also fixed concidence a bit to get the second half of
tiger further along.
All existing tests, including extended testing in
Release and the first half of tiger, work.
TBR=reed@google.com
BUG=skia:5131
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2338323002
Review-Url: https://codereview.chromium.org/2338323002
Diffstat (limited to 'src/pathops/SkPathOpsCurve.cpp')
-rw-r--r-- | src/pathops/SkPathOpsCurve.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pathops/SkPathOpsCurve.cpp b/src/pathops/SkPathOpsCurve.cpp index 4bc518a3bc..e96c4e89dd 100644 --- a/src/pathops/SkPathOpsCurve.cpp +++ b/src/pathops/SkPathOpsCurve.cpp @@ -14,7 +14,7 @@ double SkDCurve::nearPoint(SkPath::Verb verb, const SkDPoint& xy, const SkDPoint int count = SkPathOpsVerbToPoints(verb); double minX = fCubic.fPts[0].fX; double maxX = minX; - for (int index = 0; index < count; ++index) { + for (int index = 1; index <= count; ++index) { minX = SkTMin(minX, fCubic.fPts[index].fX); maxX = SkTMax(maxX, fCubic.fPts[index].fX); } @@ -23,7 +23,7 @@ double SkDCurve::nearPoint(SkPath::Verb verb, const SkDPoint& xy, const SkDPoint } double minY = fCubic.fPts[0].fY; double maxY = minY; - for (int index = 0; index < count; ++index) { + for (int index = 1; index <= count; ++index) { minY = SkTMin(minY, fCubic.fPts[index].fY); maxY = SkTMax(maxY, fCubic.fPts[index].fY); } |