shape ops work in progress
M Intersection/Simplify.cpp
git-svn-id: http://skia.googlecode.com/svn/trunk@4560 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/Simplify.cpp b/experimental/Intersection/Simplify.cpp
index 6946921..a9f7a40 100644
--- a/experimental/Intersection/Simplify.cpp
+++ b/experimental/Intersection/Simplify.cpp
@@ -28,6 +28,7 @@
#define DEBUG_CROSS 0
#define DEBUG_DUMP 0
#define DEBUG_PATH_CONSTRUCTION 0
+#define DEBUG_ACTIVE_SPANS 0
#define DEBUG_WINDING 0
#define DEBUG_UNUSED 0 // set to expose unused functions
#define DEBUG_MARK_DONE 0
@@ -41,12 +42,18 @@
#define DEBUG_CROSS 1
#define DEBUG_DUMP 1
#define DEBUG_PATH_CONSTRUCTION 1
+#define DEBUG_ACTIVE_SPANS 01
#define DEBUG_WINDING 01
#define DEBUG_UNUSED 0 // set to expose unused functions
#define DEBUG_MARK_DONE 01
#endif
+#if DEBUG_ACTIVE_SPANS && !DEBUG_DUMP
+#undef DEBUG_DUMP
+#define DEBUG_DUMP 1
+#endif
+
#if DEBUG_DUMP
static const char* kLVerbStr[] = {"", "line", "quad", "cubic"};
// static const char* kUVerbStr[] = {"", "Line", "Quad", "Cubic"};
@@ -1768,6 +1775,33 @@
}
#endif
+#if DEBUG_ACTIVE_SPANS
+ void debugShowActiveSpans(int contourID, int segmentIndex) {
+ if (done()) {
+ return;
+ }
+ for (int i = 0; i < fTs.count(); ++i) {
+ if (fTs[i].fDone) {
+ continue;
+ }
+ SkDebugf("%s contour=%d segment=%d (%d)", __FUNCTION__, contourID,
+ segmentIndex, fID);
+ SkDebugf(" (%1.9g,%1.9g", fPts[0].fX, fPts[0].fY);
+ for (int vIndex = 1; vIndex <= fVerb; ++vIndex) {
+ SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
+ }
+ const Span* span = &fTs[i];
+ SkDebugf(") fT=%d (%1.9g) (%1.9g,%1.9g)", i, fTs[i].fT,
+ xAtT(span), yAtT(i));
+ const Segment* other = fTs[i].fOther;
+ SkDebugf(" other=%d otherT=%1.9g otherIndex=%d", other->fID,
+ fTs[i].fOtherT, fTs[i].fOtherIndex);
+ SkDebugf(" windSum=%d windValue=%d\n", fTs[i].fWindSum,
+ fTs[i].fWindValue);
+ }
+ }
+#endif
+
private:
const SkPoint* fPts;
SkPath::Verb fVerb;
@@ -2071,6 +2105,14 @@
}
#endif
+#if DEBUG_ACTIVE_SPANS
+ void debugShowActiveSpans() {
+ for (int index = 0; index < fSegments.count(); ++index) {
+ fSegments[index].debugShowActiveSpans(fID, index);
+ }
+ }
+#endif
+
protected:
void setBounds() {
int count = fSegments.count();
@@ -2807,6 +2849,14 @@
return NULL;
}
+#if DEBUG_ACTIVE_SPANS
+static void debugShowActiveSpans(SkTDArray<Contour*>& contourList) {
+ for (int index = 0; index < contourList.count(); ++ index) {
+ contourList[index]->debugShowActiveSpans();
+ }
+}
+#endif
+
// Each segment may have an inside or an outside. Segments contained within
// winding may have insides on either side, and form a contour that should be
// ignored. Segments that are coincident with opposing direction segments may
@@ -2884,6 +2934,9 @@
simple.close();
}
current = findChase(chaseArray, index, endIndex);
+#if DEBUG_ACTIVE_SPANS
+ debugShowActiveSpans(contourList);
+#endif
if (!current) {
break;
}