diff options
author | caryclark <caryclark@google.com> | 2015-08-18 07:12:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-18 07:12:44 -0700 |
commit | 94c902e63d77641cadd76155c2b248d04f63b560 (patch) | |
tree | be27444690e07e19d1faadeaa2ea4017fafe3f49 /src/pathops/SkIntersections.h | |
parent | f82c13fced695e0f1c0bb1760374ab1d77cd4026 (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/SkIntersections.h')
-rw-r--r-- | src/pathops/SkIntersections.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pathops/SkIntersections.h b/src/pathops/SkIntersections.h index c12db38b6c..ac9276beec 100644 --- a/src/pathops/SkIntersections.h +++ b/src/pathops/SkIntersections.h @@ -188,6 +188,7 @@ public: } void setMax(int max) { + SkASSERT(max <= (int) SK_ARRAY_COUNT(fPt)); fMax = max; } @@ -286,9 +287,9 @@ private: void cleanUpParallelLines(bool parallel); void computePoints(const SkDLine& line, int used); - SkDPoint fPt[10]; // FIXME: since scans store points as SkPoint, this should also + SkDPoint fPt[12]; // FIXME: since scans store points as SkPoint, this should also SkDPoint fPt2[2]; // used by nearly same to store alternate intersection point - double fT[2][10]; + double fT[2][12]; uint16_t fIsCoincident[2]; // bit set for each curve's coincident T bool fNearlySame[2]; // true if end points nearly match unsigned char fUsed; |