fix winding bug in lineclipper
expose path.dump() all the time
UP arrow now toggles a grid of clip rects in sample app



git-svn-id: http://skia.googlecode.com/svn/trunk@443 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp
index 9164f7c..58bf603 100644
--- a/src/core/SkLineClipper.cpp
+++ b/src/core/SkLineClipper.cpp
@@ -124,21 +124,26 @@
     SkPoint resultStorage[kMaxPoints];
     SkPoint* result;    // points to our results, either tmp or resultStorage
     int lineCount = 1;
+    bool reverse;
 
     if (pts[0].fX < pts[1].fX) {
         index0 = 0;
         index1 = 1;
+        reverse = false;
     } else {
         index0 = 1;
         index1 = 0;
+        reverse = true;
     }
-    
+
     if (tmp[index1].fX <= clip.fLeft) {  // wholly to the left
         tmp[0].fX = tmp[1].fX = clip.fLeft;
         result = tmp;
+        reverse = false;
     } else if (tmp[index0].fX >= clip.fRight) {    // wholly to the right
         tmp[0].fX = tmp[1].fX = clip.fRight;
         result = tmp;
+        reverse = false;
     } else {
         result = resultStorage;
         SkPoint* r = result;
@@ -164,7 +169,7 @@
     }
 
     // Now copy the results into the caller's lines[] parameter
-    if (0 == index1) {
+    if (reverse) {
         // copy the pts in reverse order to maintain winding order
         for (int i = 0; i <= lineCount; i++) {
             lines[lineCount - i] = result[i];
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 63c3eb0..55be129 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1222,30 +1222,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
 
-#ifdef SK_DEBUG
-
-void SkPath::validate() const {
-    SkASSERT(this != NULL);
-    SkASSERT((fFillType & ~3) == 0);
-    fPts.validate();
-    fVerbs.validate();
-
-    if (!fBoundsIsDirty) {
-        SkRect bounds;
-        compute_pt_bounds(&bounds, fPts);
-        if (fPts.count() <= 1) {
-            // if we're empty, fBounds may be empty but translated, so we can't
-            // necessarily compare to bounds directly
-            // try path.addOval(2, 2, 2, 2) which is empty, but the bounds will
-            // be [2, 2, 2, 2]
-            SkASSERT(bounds.isEmpty());
-            SkASSERT(fBounds.isEmpty());
-        } else {
-            fBounds.contains(bounds);
-        }
-    }
-}
-
 void SkPath::dump(bool forceClose, const char title[]) const {
     Iter    iter(*this, forceClose);
     SkPoint pts[4];
@@ -1306,4 +1282,31 @@
     SkDebugf("path: done %s\n", title ? title : "");
 }
 
+void SkPath::dump() const {
+    this->dump(false);
+}
+
+#ifdef SK_DEBUG
+void SkPath::validate() const {
+    SkASSERT(this != NULL);
+    SkASSERT((fFillType & ~3) == 0);
+    fPts.validate();
+    fVerbs.validate();
+    
+    if (!fBoundsIsDirty) {
+        SkRect bounds;
+        compute_pt_bounds(&bounds, fPts);
+        if (fPts.count() <= 1) {
+            // if we're empty, fBounds may be empty but translated, so we can't
+            // necessarily compare to bounds directly
+            // try path.addOval(2, 2, 2, 2) which is empty, but the bounds will
+            // be [2, 2, 2, 2]
+            SkASSERT(bounds.isEmpty());
+            SkASSERT(fBounds.isEmpty());
+        } else {
+            fBounds.contains(bounds);
+        }
+    }
+}
 #endif
+