shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@6470 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/Simplify.cpp b/experimental/Intersection/Simplify.cpp
index 30044c5..d6396ea 100644
--- a/experimental/Intersection/Simplify.cpp
+++ b/experimental/Intersection/Simplify.cpp
@@ -29,7 +29,7 @@
#define TRY_ROTATE 1
#define DEBUG_UNUSED 0 // set to expose unused functions
-#define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging
+#define FORCE_RELEASE 0 // set force release to 1 for multiple thread -- no debugging
#if FORCE_RELEASE || defined SK_RELEASE
@@ -1476,7 +1476,15 @@
const double oStartT = oTest->fT;
do {
if (transfer) {
- if (!decrementThis & !thisXor & !opp) {
+ if (opp) {
+ if (decrementThis) {
+ if (decrementSpan(end)) {
+ TrackOutside(outsideTs, end->fT, oStartT);
+ }
+ } else {
+ end->fOppValue += oTest->fWindValue;
+ }
+ } else if (!decrementThis & !thisXor) {
#ifdef SK_DEBUG
SkASSERT(abs(end->fWindValue) < gDebugMaxWindValue);
#endif
@@ -1484,14 +1492,6 @@
} else if (decrementSpan(end)) {
TrackOutside(outsideTs, end->fT, oStartT);
}
- } else if (opp) {
- if (decrementThis) {
- if (decrementSpan(end)) {
- TrackOutside(outsideTs, end->fT, oStartT);
- }
- } else {
- end->fOppValue += oTest->fWindValue;
- }
} else if (oTest->fWindValue) {
SkASSERT(decrementThis);
if (startIndex > 0 && fTs[startIndex - 1].fWindValue) {
@@ -1520,7 +1520,15 @@
while (!approximately_negative(oEndT - oEnd->fT)
&& approximately_negative(oEnd->fT - otherTMatch)) {
if (transfer) {
- if (decrementThis & !otherXor & !opp) {
+ if (opp) {
+ if (decrementThis) {
+ oEnd->fOppValue += test->fWindValue;
+ } else {
+ if (decrementSpan(oEnd)) {
+ TrackOutside(oOutsideTs, oEnd->fT, startT);
+ }
+ }
+ } else if (decrementThis & !otherXor & !opp) {
#ifdef SK_DEBUG
SkASSERT(abs(oEnd->fWindValue) < gDebugMaxWindValue);
#endif
@@ -1528,14 +1536,6 @@
} else if (decrementSpan(oEnd)) {
TrackOutside(oOutsideTs, oEnd->fT, startT);
}
- } else if (opp) {
- if (decrementThis) {
- oEnd->fOppValue += test->fWindValue;
- } else {
- if (decrementSpan(oEnd)) {
- TrackOutside(oOutsideTs, oEnd->fT, startT);
- }
- }
} else if (test->fWindValue) {
SkASSERT(decrementThis);
if (oStartIndex > 0 && fTs[oStartIndex - 1].fWindValue) {
@@ -1579,7 +1579,7 @@
SkTDArray<double> xOutsideTs;
SkTDArray<double> oOutsideTs;
do {
- bool transfer = test->fWindValue && oTest->fWindValue && !opp;
+ bool transfer = test->fWindValue && oTest->fWindValue;
bool decrementThis = test->fWindValue < oTest->fWindValue;
if (decrementThis) {
oIndex = other.bumpCoincidentOther(test, transfer, decrementThis, otherXor, opp,
@@ -1689,7 +1689,7 @@
other->addTwoAngles(next, oIndex, angles);
}
- int computeSum(int startIndex, int endIndex) {
+ int computeSum(int startIndex, int endIndex, int* oppoSum) {
SkTDArray<Angle> angles;
addTwoAngles(startIndex, endIndex, angles);
buildAngles(endIndex, angles, false);
@@ -1751,7 +1751,11 @@
segment->markAndChaseWinding(angle, maxWinding);
}
} while (++nextIndex != lastIndex);
- return windSum(SkMin32(startIndex, endIndex));
+ int minIndex = SkMin32(startIndex, endIndex);
+ if (oppoSum) {
+ *oppoSum = oppSum(minIndex);
+ }
+ return windSum(minIndex);
}
int crossedSpan(const SkPoint& basePt, SkScalar& bestY, double& hitT) const {
@@ -3233,6 +3237,15 @@
return xyAtT(span).fY;
}
+ void zeroSpan(Span* span) {
+ SkASSERT(span->fWindValue > 0);
+ span->fWindValue = 0;
+ if (!span->fDone) {
+ span->fDone = true;
+ ++fDoneSpans;
+ }
+ }
+
#if DEBUG_DUMP
void dump() const {
const char className[] = "Segment";
@@ -4990,7 +5003,7 @@
int sumWinding = current->windSum(SkMin32(index, endIndex));
// FIXME: don't I have to adjust windSum to get contourWinding?
if (sumWinding == SK_MinS32) {
- sumWinding = current->computeSum(index, endIndex);
+ sumWinding = current->computeSum(index, endIndex, NULL);
}
if (sumWinding == SK_MinS32) {
contourWinding = innerContourCheck(contourList, current,