Fixing SkClipStack::clipDevPath so that it will not convert rectangular paths to rectangle clips if inverse fill.

BUG=http://code.google.com/p/chromium/issues/detail?id=164580
TEST=unit test ClipStackTest/test_rect_inverse_fill
Review URL: https://codereview.appspot.com/6880044

git-svn-id: http://skia.googlecode.com/svn/trunk@6731 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 29d008a..bb4ea08 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -541,7 +541,7 @@
 
 void SkClipStack::clipDevPath(const SkPath& path, SkRegion::Op op, bool doAA) {
     SkRect alt;
-    if (path.isRect(&alt)) {
+    if (path.isRect(&alt) && !path.isInverseFillType()) {
         return this->clipDevRect(alt, op, doAA);
     }
 
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index 9b4a68f..03da7f1 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -375,6 +375,23 @@
     return count;
 }
 
+static void test_rect_inverse_fill(skiatest::Reporter* reporter) {
+    // non-intersecting rectangles
+    SkRect rect  = SkRect::MakeLTRB(0, 0, 10, 10);
+
+    SkPath path;
+    path.addRect(rect);
+    path.toggleInverseFillType();
+    SkClipStack stack;
+    stack.clipDevPath(path, SkRegion::kIntersect_Op, false);
+
+    SkRect bounds;
+    SkClipStack::BoundsType boundsType;
+    stack.getBounds(&bounds, &boundsType);
+    REPORTER_ASSERT(reporter, SkClipStack::kInsideOut_BoundsType == boundsType);
+    REPORTER_ASSERT(reporter, bounds == rect);
+}
+
 // Test out SkClipStack's merging of rect clips. In particular exercise
 // merging of aa vs. bw rects.
 static void test_rect_merging(skiatest::Reporter* reporter) {
@@ -755,6 +772,7 @@
     test_bounds(reporter, false);       // once with paths
     test_isWideOpen(reporter);
     test_rect_merging(reporter);
+    test_rect_inverse_fill(reporter);
 #if SK_SUPPORT_GPU
     test_reduced_clip_stack(reporter);
 #endif