Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: src/pathops/SkIntersections.h

Issue 23542056: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: verbose + mutex around file number access Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkIntersectionHelper.h ('k') | src/pathops/SkIntersections.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkIntersections.h
diff --git a/src/pathops/SkIntersections.h b/src/pathops/SkIntersections.h
index 389098d84e67136dff4160f9d2635879e7fc4c71..f63a023ef0a5ef26c21c42ecfc8bd5b0c2a88fc3 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
« no previous file with comments | « src/pathops/SkIntersectionHelper.h ('k') | src/pathops/SkIntersections.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698