path ops work in progress

standardize tests
use SK_ARRAY_COUNT everywhere
debug why x87 differs from SIMD 64
various platform specific fixes

git-svn-id: http://skia.googlecode.com/svn/trunk@8689 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pathops/SkDCubicIntersection.cpp b/src/pathops/SkDCubicIntersection.cpp
index a31b1a4..f9d8cd5 100644
--- a/src/pathops/SkDCubicIntersection.cpp
+++ b/src/pathops/SkDCubicIntersection.cpp
@@ -101,8 +101,6 @@
             char tab[] = "                  ";
             if (tLimits1[0][0] >= t1Start && tLimits1[0][1] <= t1
                     && tLimits1[1][0] >= t2Start && tLimits1[1][1] <= t2) {
-                SkDCubic cSub1 = cubic1.subDivide(t1Start, t1);
-                SkDCubic cSub2 = cubic2.subDivide(t2Start, t2);
                 SkDebugf("%.*s %s t1=(%1.9g,%1.9g) t2=(%1.9g,%1.9g)", i.depth()*2, tab,
                         __FUNCTION__, t1Start, t1, t2Start, t2);
                 SkIntersections xlocals;
diff --git a/src/pathops/SkDQuadIntersection.cpp b/src/pathops/SkDQuadIntersection.cpp
index d8e3f20..db4e2fa 100644
--- a/src/pathops/SkDQuadIntersection.cpp
+++ b/src/pathops/SkDQuadIntersection.cpp
@@ -96,6 +96,9 @@
         }
         for (int n = 0; n < 3; ++n) {
             double test = (q2[n].fY - origY) * adj - (q2[n].fX - origX) * opp;
+            if (test * sign > 0 && precisely_zero(test)) {
+                SkDebugf("*** very teeny\n");
+            }
             if (test * sign > 0) {
                 goto tryNextHalfPlane;
             }
@@ -151,7 +154,7 @@
     SkDQuad hull = q1.subDivide(t1s, t1e);
     SkDLine line = {{hull[2], hull[0]}};
     const SkDLine* testLines[] = { &line, (const SkDLine*) &hull[0], (const SkDLine*) &hull[1] };
-    size_t testCount = sizeof(testLines) / sizeof(testLines[0]);
+    size_t testCount = SK_ARRAY_COUNT(testLines);
     SkTDArray<double> tsFound;
     for (size_t index = 0; index < testCount; ++index) {
         SkIntersections rootTs;
diff --git a/src/pathops/SkOpAngle.h b/src/pathops/SkOpAngle.h
index d599dea..00520ec 100644
--- a/src/pathops/SkOpAngle.h
+++ b/src/pathops/SkOpAngle.h
@@ -18,6 +18,7 @@
 class SkOpAngle {
 public:
     bool operator<(const SkOpAngle& rh) const;
+
     double dx() const {
         return fTangent1.dx();
     }
@@ -36,10 +37,12 @@
 
     bool lengthen();
     bool reverseLengthen();
+
     void set(const SkPoint* orig, SkPath::Verb verb, const SkOpSegment* segment,
             int start, int end, const SkTDArray<SkOpSpan>& spans);
 
     void setSpans();
+
     SkOpSegment* segment() const {
         return const_cast<SkOpSegment*>(fSegment);
     }
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 79ecc66..30e78f5 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -2663,7 +2663,7 @@
     int oppoSign = oppSign(firstAngle);
     int oppWindSum = oppLastSum - oppoSign;
     #define WIND_AS_STRING(x) char x##Str[12]; if (!valid_wind(x)) strcpy(x##Str, "?"); \
-        else snprintf(x##Str, sizeof(x##Str), "%d", x)
+        else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x)
     WIND_AS_STRING(contourWinding);
     WIND_AS_STRING(oppContourWinding);
     SkDebugf("%s %s contourWinding=%s oppContourWinding=%s sign=%d\n", fun, __FUNCTION__,
@@ -2747,7 +2747,7 @@
                     opp ? windSumStr : oppWindSumStr);
         }
         SkDebugf(" done=%d tiny=%d opp=%d\n", mSpan.fDone, mSpan.fTiny, opp);
-#if false && DEBUG_ANGLE
+#if 0 && DEBUG_ANGLE
         angle.debugShow(segment.xyAtT(&sSpan));
 #endif
         ++index;
diff --git a/src/pathops/SkOpSegment.h b/src/pathops/SkOpSegment.h
index dd51ab8..f4f2aa5 100644
--- a/src/pathops/SkOpSegment.h
+++ b/src/pathops/SkOpSegment.h
@@ -151,6 +151,11 @@
         return fTs[tIndex];
     }
 
+    // OPTIMIZATION: mark as debugging only if used solely by tests
+    const SkTDArray<SkOpSpan>& spans() const {
+        return fTs;
+    }
+
     int spanSign(const SkOpAngle* angle) const {
         SkASSERT(angle->segment() == this);
         return spanSign(angle->start(), angle->end());
diff --git a/src/pathops/SkPathOpsDebug.h b/src/pathops/SkPathOpsDebug.h
index a642af4..065ba4b 100644
--- a/src/pathops/SkPathOpsDebug.h
+++ b/src/pathops/SkPathOpsDebug.h
@@ -12,7 +12,7 @@
 #ifdef SK_RELEASE
 #define FORCE_RELEASE 1
 #else
-#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
 #endif
 
 #define ONE_OFF_DEBUG 0
diff --git a/src/pathops/SkPathOpsPoint.h b/src/pathops/SkPathOpsPoint.h
index 3805100..713b457 100644
--- a/src/pathops/SkPathOpsPoint.h
+++ b/src/pathops/SkPathOpsPoint.h
@@ -108,7 +108,7 @@
 
     bool approximatelyEqual(const SkPoint& a) const {
         double denom = SkTMax<double>(fabs(fX), SkTMax<double>(fabs(fY),
-                SkScalarToDouble(SkTMax<SkScalar>(fabs(a.fX), fabs(a.fY)))));
+                SkScalarToDouble(SkTMax<SkScalar>(fabsf(a.fX), fabsf(a.fY)))));
         if (denom == 0) {
             return true;
         }