diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-02 14:49:34 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-02 14:49:34 +0000 |
commit | 7eaa53d8f7e48fd17d02b5e3bd91f90e9c1899ef (patch) | |
tree | 057de94d997d99e897c68157f7444fbca687ebf9 /src/pathops/SkIntersections.h | |
parent | 77af6805e5faea1e2a5c0220098aec9082f3a6e5 (diff) |
path ops work in progress
make more skps work
remove edit files
BUG=
Review URL: https://codereview.chromium.org/23542056
git-svn-id: http://skia.googlecode.com/svn/trunk@11570 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops/SkIntersections.h')
-rw-r--r-- | src/pathops/SkIntersections.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/pathops/SkIntersections.h b/src/pathops/SkIntersections.h index 389098d84e..f63a023ef0 100644 --- a/src/pathops/SkIntersections.h +++ b/src/pathops/SkIntersections.h @@ -25,6 +25,7 @@ public: sk_bzero(fIsCoincident, sizeof(fIsCoincident)); sk_bzero(&fIsNear, sizeof(fIsNear)); reset(); + fMax = 0; // require that the caller set the max } class TArray { @@ -43,6 +44,7 @@ public: memcpy(fIsCoincident, i.fIsCoincident, sizeof(fIsCoincident)); memcpy(&fIsNear, &i.fIsNear, sizeof(fIsNear)); fUsed = i.fUsed; + fMax = i.fMax; fSwap = i.fSwap; SkDEBUGCODE(fDepth = i.fDepth); } @@ -54,6 +56,7 @@ public: int cubic(const SkPoint a[4]) { SkDCubic cubic; cubic.set(a); + fMax = 1; // self intersect return intersect(cubic); } @@ -62,6 +65,7 @@ public: aCubic.set(a); SkDCubic bCubic; bCubic.set(b); + fMax = 9; return intersect(aCubic, bCubic); } @@ -69,12 +73,14 @@ public: bool flipped) { SkDCubic cubic; cubic.set(a); + fMax = 3; return horizontal(cubic, left, right, y, flipped); } int cubicVertical(const SkPoint a[4], SkScalar top, SkScalar bottom, SkScalar x, bool flipped) { SkDCubic cubic; cubic.set(a); + fMax = 3; return vertical(cubic, top, bottom, x, flipped); } @@ -83,6 +89,7 @@ public: cubic.set(a); SkDLine line; line.set(b); + fMax = 3; return intersect(cubic, line); } @@ -91,6 +98,7 @@ public: cubic.set(a); SkDQuad quad; quad.set(b); + fMax = 6; return intersect(cubic, quad); } @@ -119,12 +127,14 @@ public: bool flipped) { SkDLine line; line.set(a); + fMax = 2; return horizontal(line, left, right, y, flipped); } int lineVertical(const SkPoint a[2], SkScalar top, SkScalar bottom, SkScalar x, bool flipped) { SkDLine line; line.set(a); + fMax = 2; return vertical(line, top, bottom, x, flipped); } @@ -132,6 +142,7 @@ public: SkDLine aLine, bLine; aLine.set(a); bLine.set(b); + fMax = 2; return intersect(aLine, bLine); } @@ -143,12 +154,14 @@ public: bool flipped) { SkDQuad quad; quad.set(a); + fMax = 2; return horizontal(quad, left, right, y, flipped); } int quadVertical(const SkPoint a[3], SkScalar top, SkScalar bottom, SkScalar x, bool flipped) { SkDQuad quad; quad.set(a); + fMax = 2; return vertical(quad, top, bottom, x, flipped); } @@ -157,6 +170,7 @@ public: quad.set(a); SkDLine line; line.set(b); + fMax = 2; return intersect(quad, line); } @@ -165,18 +179,23 @@ public: aQuad.set(a); SkDQuad bQuad; bQuad.set(b); + fMax = 4; return intersect(aQuad, bQuad); } int quadRay(const SkPoint pts[3], const SkDLine& line); void removeOne(int index); - // leaves flip, swap alone + // leaves flip, swap, max alone void reset() { fAllowNear = true; fUsed = 0; } + void setMax(int max) { + fMax = max; + } + void swap() { fSwap ^= true; } @@ -200,6 +219,7 @@ public: } static double Axial(const SkDQuad& , const SkDPoint& , bool vertical); + void cleanUpCoincidence(); int coincidentUsed() const; int cubicRay(const SkPoint pts[4], const SkDLine& line); void flip(); @@ -246,7 +266,11 @@ public: } private: - int computePoints(const SkDLine& line, int used); + bool cubicCheckCoincidence(const SkDCubic& c1, const SkDCubic& c2); + bool cubicExactEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic2); + void cubicNearEnd(const SkDCubic& cubic1, bool start, const SkDCubic& cubic2, const SkDRect& ); + void cleanUpParallelLines(bool parallel); + void computePoints(const SkDLine& line, int used); // used by addCoincident to remove ordinary intersections in range // void remove(double one, double two, const SkDPoint& startPt, const SkDPoint& endPt); @@ -255,6 +279,7 @@ private: uint16_t fIsCoincident[2]; // bit set for each curve's coincident T uint16_t fIsNear; // bit set for each T if 2nd curve's point is near but not equal to 1st unsigned char fUsed; + unsigned char fMax; bool fAllowNear; bool fSwap; #ifdef SK_DEBUG |