diff options
author | caryclark <caryclark@google.com> | 2015-04-20 08:31:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-20 08:31:59 -0700 |
commit | 1049f1246e7be4ccb68001361efceb8933e6f81c (patch) | |
tree | 9c71ceb245856cbe2173913eaec3b0ebb490dd74 /src/pathops/SkIntersections.h | |
parent | 5c476fb2776639bdbf0e974dd38d1c5d4c4ff1aa (diff) |
Now, path ops natively intersect conics, quads, and cubics in any combination. There are still a class of cubic tests that fail and a handful of undiagnosed failures from skps and fuzz tests, but things are much better overall.
Extended tests (150M+) run to completion in release in about 6 minutes; the standard test suite exceeds 100K and finishes in a few seconds on desktops.
TBR=reed
BUG=skia:3588
Review URL: https://codereview.chromium.org/1037953004
Diffstat (limited to 'src/pathops/SkIntersections.h')
-rw-r--r-- | src/pathops/SkIntersections.h | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/src/pathops/SkIntersections.h b/src/pathops/SkIntersections.h index 15bac19def..57fb49bcd2 100644 --- a/src/pathops/SkIntersections.h +++ b/src/pathops/SkIntersections.h @@ -7,6 +7,7 @@ #ifndef SkIntersections_DEFINE #define SkIntersections_DEFINE +#include "SkPathOpsConic.h" #include "SkPathOpsCubic.h" #include "SkPathOpsLine.h" #include "SkPathOpsPoint.h" @@ -49,6 +50,31 @@ public: fIsCoincident[1] &= ~bit; } + int conicHorizontal(const SkPoint a[3], SkScalar weight, SkScalar left, SkScalar right, + SkScalar y, bool flipped) { + SkDConic conic; + conic.set(a, weight); + fMax = 2; + return horizontal(conic, left, right, y, flipped); + } + + int conicVertical(const SkPoint a[3], SkScalar weight, SkScalar top, SkScalar bottom, + SkScalar x, bool flipped) { + SkDConic conic; + conic.set(a, weight); + fMax = 2; + return vertical(conic, top, bottom, x, flipped); + } + + int conicLine(const SkPoint a[3], SkScalar weight, const SkPoint b[2]) { + SkDConic conic; + conic.set(a, weight); + SkDLine line; + line.set(b); + fMax = 3; // 2; permit small coincident segment + non-coincident intersection + return intersect(conic, line); + } + int cubicHorizontal(const SkPoint a[4], SkScalar left, SkScalar right, SkScalar y, bool flipped) { SkDCubic cubic; @@ -206,6 +232,7 @@ public: int horizontal(const SkDQuad&, double left, double right, double y, bool flipped); int horizontal(const SkDQuad&, double left, double right, double y, double tRange[2]); int horizontal(const SkDCubic&, double y, double tRange[3]); + int horizontal(const SkDConic&, double left, double right, double y, bool flipped); int horizontal(const SkDCubic&, double left, double right, double y, bool flipped); int horizontal(const SkDCubic&, double left, double right, double y, double tRange[3]); // FIXME : does not respect swap @@ -216,10 +243,16 @@ public: int intersect(const SkDLine&, const SkDLine&); int intersect(const SkDQuad&, const SkDLine&); int intersect(const SkDQuad&, const SkDQuad&); + int intersect(const SkDConic&, const SkDLine&); + int intersect(const SkDConic&, const SkDQuad&); + int intersect(const SkDConic&, const SkDConic&); int intersect(const SkDCubic&, const SkDLine&); + int intersect(const SkDCubic&, const SkDQuad&); + int intersect(const SkDCubic&, const SkDConic&); int intersect(const SkDCubic&, const SkDCubic&); int intersectRay(const SkDLine&, const SkDLine&); int intersectRay(const SkDQuad&, const SkDLine&); + int intersectRay(const SkDConic&, const SkDLine&); int intersectRay(const SkDCubic&, const SkDLine&); void merge(const SkIntersections& , int , const SkIntersections& , int ); int mostOutside(double rangeStart, double rangeEnd, const SkDPoint& origin) const; @@ -228,10 +261,16 @@ public: void setCoincident(int index); int vertical(const SkDLine&, double top, double bottom, double x, bool flipped); int vertical(const SkDQuad&, double top, double bottom, double x, bool flipped); + int vertical(const SkDConic&, double top, double bottom, double x, bool flipped); int vertical(const SkDCubic&, double top, double bottom, double x, bool flipped); - int verticalCubic(const SkPoint a[4], SkScalar top, SkScalar bottom, SkScalar x, bool flipped); - int verticalLine(const SkPoint a[2], SkScalar top, SkScalar bottom, SkScalar x, bool flipped); - int verticalQuad(const SkPoint a[3], SkScalar top, SkScalar bottom, SkScalar x, bool flipped); + int verticalConic(const SkPoint a[3], SkScalar weight, SkScalar top, SkScalar bottom, + SkScalar x, bool flipped); + int verticalCubic(const SkPoint a[4], SkScalar weight, SkScalar top, SkScalar bottom, + SkScalar x, bool flipped); + int verticalLine(const SkPoint a[2], SkScalar weight, SkScalar top, SkScalar bottom, + SkScalar x, bool flipped); + int verticalQuad(const SkPoint a[3], SkScalar weight, SkScalar top, SkScalar bottom, + SkScalar x, bool flipped); int depth() const { #ifdef SK_DEBUG @@ -264,7 +303,7 @@ private: #endif }; -extern int (SkIntersections::* const CurveVertical[])(const SkPoint[], SkScalar top, SkScalar bottom, - SkScalar x, bool flipped); +extern int (SkIntersections::* const CurveVertical[])(const SkPoint[], SkScalar weight, + SkScalar top, SkScalar bottom, SkScalar x, bool flipped); #endif |