path ops : fix empty-diff bug, op-in-place

add some debugging around reverse diff, inverse
Review URL: https://codereview.chromium.org/13851015

git-svn-id: http://skia.googlecode.com/svn/trunk@8852 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index c5dbceb..4626454 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -29,6 +29,7 @@
     "kIntersect_PathOp",
     "kUnion_PathOp",
     "kXor_PathOp",
+    "kReverseDifference_PathOp",
 };
 
 static const char* opSuffixes[] = {
@@ -43,7 +44,7 @@
 static bool gComparePathsAssert = true;
 static bool gPathStrAssert = true;
 
-static void showPathContour(SkPath::Iter& iter) {
+static void showPathContours(SkPath::Iter& iter) {
     uint8_t verb;
     SkPoint pts[4];
     while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
@@ -77,6 +78,13 @@
     showPath(path);
 }
 
+const char* fillTypeStr[] = {
+    "kWinding_FillType",
+    "kEvenOdd_FillType",
+    "kInverseWinding_FillType",
+    "kInverseEvenOdd_FillType"
+};
+
 void showPath(const SkPath& path) {
     SkPath::Iter iter(path, true);
 #define SUPPORT_RECT_CONTOUR_DETECTION 0
@@ -97,8 +105,11 @@
         return;
     }
 #endif
+    SkPath::FillType fillType = path.getFillType();
+    SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInverseEvenOdd_FillType);
+    SkDebugf("path.setFillType(%s);\n", fillTypeStr[fillType]);
     iter.setPath(path, true);
-    showPathContour(iter);
+    showPathContours(iter);
 }
 
 void showPathData(const SkPath& path) {
@@ -145,6 +156,9 @@
         case kXOR_PathOp:
             SkDebugf("op xor\n");
             break;
+        case kReverseDifference_PathOp:
+            SkDebugf("op reverse difference\n");
+            break;
         default:
             SkASSERT(0);
     }
@@ -356,10 +370,13 @@
     int errors2x2;
     int errors = pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2);
     if (errors2x2 == 0) {
+        if (gShowPath) {
+            showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale);
+        }
         return 0;
     }
     const int MAX_ERRORS = 8;
-    if (errors2x2 == MAX_ERRORS || errors2x2 == MAX_ERRORS - 1) {
+    if (gShowPath || errors2x2 == MAX_ERRORS || errors2x2 == MAX_ERRORS - 1) {
         showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale);
     }
     if (errors2x2 > MAX_ERRORS && gComparePathsAssert) {