shape ops work in progress

git-svn-id: http://skia.googlecode.com/svn/trunk@4815 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/SimplifyRect4x4_Test.cpp b/experimental/Intersection/SimplifyRect4x4_Test.cpp
index 1b87f3f..d97bdbd 100644
--- a/experimental/Intersection/SimplifyRect4x4_Test.cpp
+++ b/experimental/Intersection/SimplifyRect4x4_Test.cpp
@@ -11,6 +11,7 @@
 #include "SkCanvas.h"
 #include "SkStream.h"
 #include <assert.h>
+#include <errno.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -29,7 +30,11 @@
     "\n"
     "var testDivs = [\n";
 static const char testLineStr[] = "    testLine";
+#if 0
 static const char filename[] = "../../experimental/Intersection/debugXX.txt";
+#else
+static const char filename[] = "/flash/debug/XX.txt";
+#endif
 static int testNumber;
 
 static void* testSimplify4x4RectsMain(void* data)
@@ -38,6 +43,7 @@
     bzero(pathStr, sizeof(pathStr));
     SkASSERT(data);
     State4& state = *(State4*) data;
+    state.testsRun = 0;
     int aShape = state.a & 0x03;
     int aCW = state.a >> 2;
     int bShape = state.b & 0x03;
@@ -179,6 +185,7 @@
             getcwd(pwd, sizeof(pwd));
             SkDebugf("%s\n", pwd);
     #endif
+    #if 1
             SkFILEWStream outFile(state.filename);
             if (!outFile.isValid()) {
                 continue;
@@ -211,8 +218,10 @@
             outFile.writeDecAsText(testNumber);
             outFile.writeText("),\n");
             outFile.flush();
+    #endif
         }
         testSimplifyx(path, out, state.bitmap, state.canvas);
+        state.testsRun++;
                                 }
                             }
                         }
@@ -229,15 +238,16 @@
 void Simplify4x4RectsThreaded_Test()
 {
 #ifdef SK_DEBUG
-    gDebugMaxWindSum = 3;
-    gDebugMaxWindValue = 3;
+    gDebugMaxWindSum = 4;
+    gDebugMaxWindValue = 4;
 #endif
     int maxThreads = 1;
     if (!gRunTestsInOneThread) {
-        size_t size;
         int threads = -1;
+        size_t size = sizeof(threads);
         sysctlbyname("hw.logicalcpu_max", &threads, &size, NULL, 0);
-        SkDebugf("%s size=%d processors=%d\n", __FUNCTION__, size, threads);
+        SkDebugf("%s errno=%d size=%d processors=%d\n", __FUNCTION__, 
+                errno, size, threads);
         if (threads > 0) {
             maxThreads = threads;
         } else {
@@ -272,6 +282,7 @@
         statePtr->filename[sizeof(filename) - 6] = '0' + threadIndex % 10;
     }
     threadIndex = 0;
+    int testsRun = 0;
     for (int a = 0; a < 8; ++a) { // outermost
         for (int b = a ; b < 8; ++b) {
             for (int c = b ; c < 8; ++c) {
@@ -285,6 +296,9 @@
                         createThread(statePtr, testSimplify4x4RectsMain);
                         if (++threadIndex >= maxThreads) {
                             waitForCompletion(threadState, threadIndex);
+                            for (int index = 0; index < maxThreads; ++index) {
+                                testsRun += threadState[index].testsRun;
+                            }
                         }
                     } else {
                         testSimplify4x4RectsMain(statePtr);
@@ -298,6 +312,9 @@
         if (!gRunTestsInOneThread) SkDebugf("\n\n%d", a);
     }
     waitForCompletion(threadState, threadIndex);
+    for (int index = 0; index < maxThreads; ++index) {
+        testsRun += threadState[index].testsRun;
+    }
 #ifdef SK_DEBUG
     gDebugMaxWindSum = SK_MaxS32;
     gDebugMaxWindValue = SK_MaxS32;