aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkPathOpsTSect.h
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-08-18 07:12:43 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-18 07:12:44 -0700
commit94c902e63d77641cadd76155c2b248d04f63b560 (patch)
treebe27444690e07e19d1faadeaa2ea4017fafe3f49 /src/pathops/SkPathOpsTSect.h
parentf82c13fced695e0f1c0bb1760374ab1d77cd4026 (diff)
fix pathops fuzz failures
If a curve has the identical start and control points, the initial or final tangent can't be trivally determined. The perpendicular to the tangent is used to measure coincidence. Add logic for cubics, quadratics, and conics, to use the secondary control points or the end points if the initial control point alone can't determine the tangent. Add debugging (currently untriggered by exhaustive testing) to detect zero-length tangents which are not at the curve endpoints. Increase the number of temporary intersecions gathered from 10 to 12 but reduce the max passed in by cubic intersection from 27 to 12. Also, add checks if the max passed exceeds the storage allocated. When cleaning up parallel lines, choose the intersection which is on the end of both segments over the intersection which is on the end of a single segment. TBR=reed@google.com BUG=425140,516266 Review URL: https://codereview.chromium.org/1288863004
Diffstat (limited to 'src/pathops/SkPathOpsTSect.h')
-rw-r--r--src/pathops/SkPathOpsTSect.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pathops/SkPathOpsTSect.h b/src/pathops/SkPathOpsTSect.h
index 4cf5978d95..50e12791f7 100644
--- a/src/pathops/SkPathOpsTSect.h
+++ b/src/pathops/SkPathOpsTSect.h
@@ -1907,7 +1907,7 @@ void SkTSect<TCurve, OppCurve>::BinarySearch(SkTSect<TCurve, OppCurve>* sect1,
SkDEBUGCODE(sect1->fOppSect = sect2);
SkDEBUGCODE(sect2->fOppSect = sect1);
intersections->reset();
- intersections->setMax(TCurve::kMaxIntersections * 3); // give extra for slop
+ intersections->setMax(TCurve::kMaxIntersections + 3); // give extra for slop
SkTSpan<TCurve, OppCurve>* span1 = sect1->fHead;
SkTSpan<OppCurve, TCurve>* span2 = sect2->fHead;
int oppSect, sect = sect1->intersects(span1, sect2, span2, &oppSect);