make SkPath::conservativelyContainsRect consume degenerate segments

BUG=skia:

Change-Id: I3a39318bceaf6c95a50d84961d93af4ba62550e3
Reviewed-on: https://skia-review.googlesource.com/6900
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 53678de..4c7ebe5 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -263,14 +263,14 @@
 
     SkPoint firstPt;
     SkPoint prevPt;
-    RawIter iter(*this);
+    SkPath::Iter iter(*this, true);
     SkPath::Verb verb;
     SkPoint pts[4];
     SkDEBUGCODE(int moveCnt = 0;)
     SkDEBUGCODE(int segmentCount = 0;)
     SkDEBUGCODE(int closeCount = 0;)
 
-    while ((verb = iter.next(pts)) != kDone_Verb) {
+    while ((verb = iter.next(pts, true, true)) != kDone_Verb) {
         int nextPt = -1;
         switch (verb) {
             case kMove_Verb:
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 0ace812..42771d0 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1923,6 +1923,18 @@
                                                                                SkIntToScalar(10),
                                                                                SkIntToScalar(10))));
 
+    // Same as above path and first test but with the extra moveTo making a degenerate sub-path
+    // following the non-empty sub-path. Verifies that this does not trigger assertions.
+    path.reset();
+    path.moveTo(0, 0);
+    path.lineTo(SkIntToScalar(100), 0);
+    path.lineTo(0, SkIntToScalar(100));
+    path.moveTo(100, 100);
+
+    REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
+                                                                               SkIntToScalar(10),
+                                                                               SkIntToScalar(10))));
+
     // Test that multiple move commands do not cause asserts and that the function
     // is not confused by the multiple moves.
     path.reset();