diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-07-15 13:29:13 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-07-15 13:29:13 +0000 |
commit | fa2aeee27af27f2934ee52a9732148f66481fb03 (patch) | |
tree | 55bd975ad23945da95bdbe6e4a57aa5688baee28 /src/pathops/SkIntersections.h | |
parent | c2050e3a3ecfb8738b36e2add15c526e8e0f21fe (diff) |
path ops near exact
Modify line intersections to first
- match exact ends
- compute intersections
- match near ends
where the exact ends are preferred, then near matches, then
computed matches. This pulls matches towards existing end points
when possible, and keeps intersection distances consistent with
different line/line line/quad and line/cubic computations.
BUG=
Review URL: https://codereview.chromium.org/19183003
git-svn-id: http://skia.googlecode.com/svn/trunk@10073 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops/SkIntersections.h')
-rw-r--r-- | src/pathops/SkIntersections.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/pathops/SkIntersections.h b/src/pathops/SkIntersections.h index c0bb61fef0..de3d44cd70 100644 --- a/src/pathops/SkIntersections.h +++ b/src/pathops/SkIntersections.h @@ -45,6 +45,10 @@ public: SkDEBUGCODE(fDepth = i.fDepth); } + void allowNear(bool nearAllowed) { + fAllowNear = nearAllowed; + } + int cubic(const SkPoint a[4]) { SkDCubic cubic; cubic.set(a); @@ -88,6 +92,11 @@ public: return intersect(cubic, quad); } + bool hasT(double t) const { + SkASSERT(t == 0 || t == 1); + return fUsed > 0 && (t == 0 ? fT[0][0] == 0 : fT[0][fUsed - 1] == 1); + } + int insertSwap(double one, double two, const SkDPoint& pt) { if (fSwap) { return insert(two, one, pt); @@ -96,14 +105,6 @@ public: } } - int insertSwap(double one, double two, double x, double y) { - if (fSwap) { - return insert(two, one, x, y); - } else { - return insert(one, two, x, y); - } - } - bool isCoincident(int index) { return (fIsCoincident[0] & 1 << index) != 0; } @@ -166,6 +167,7 @@ public: // leaves flip, swap alone void reset() { + fAllowNear = true; fUsed = 0; } @@ -204,7 +206,6 @@ public: int horizontal(const SkDCubic&, double left, double right, double y, double tRange[3]); // FIXME : does not respect swap int insert(double one, double two, const SkDPoint& pt); - int insert(double one, double two, double x, double y); // start if index == 0 : end if index == 1 void insertCoincident(double one, double two, const SkDPoint& pt); void insertCoincidentPair(double s1, double e1, double s2, double e2, @@ -248,6 +249,7 @@ private: double fT[2][9]; uint16_t fIsCoincident[2]; // bit arrays, one bit set for each coincident T unsigned char fUsed; + bool fAllowNear; bool fSwap; #ifdef SK_DEBUG int fDepth; |