aaclip needs to handle paths with holes
Review URL: https://codereview.appspot.com/5671066

git-svn-id: http://skia.googlecode.com/svn/trunk@3209 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index b3051fd..194b926 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -272,15 +272,53 @@
             }
             REPORTER_ASSERT(reporter, nonEmptyAA == nonEmptyBW);
             REPORTER_ASSERT(reporter, clip2.getBounds() == rgn2.getBounds());
+            
+            SkMask maskBW, maskAA;
+            copyToMask(rgn2, &maskBW);
+            clip2.copyToMask(&maskAA);
+            REPORTER_ASSERT(reporter, maskBW == maskAA);
         }
     }
 }
 
+static void test_path_with_hole(skiatest::Reporter* reporter) {
+    static const uint8_t gExpectedImage[] = {
+        0xFF, 0xFF, 0xFF, 0xFF,
+        0xFF, 0xFF, 0xFF, 0xFF,
+        0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00,
+        0xFF, 0xFF, 0xFF, 0xFF,
+        0xFF, 0xFF, 0xFF, 0xFF,
+    };
+    SkMask expected;
+    expected.fBounds.set(0, 0, 4, 6);
+    expected.fRowBytes = 4;
+    expected.fFormat = SkMask::kA8_Format;
+    expected.fImage = (uint8_t*)gExpectedImage;
+
+    SkPath path;
+    path.addRect(SkRect::MakeXYWH(0, 0,
+                                  SkIntToScalar(4), SkIntToScalar(2)));
+    path.addRect(SkRect::MakeXYWH(0, SkIntToScalar(4),
+                                  SkIntToScalar(4), SkIntToScalar(2)));
+
+    for (int i = 0; i < 2; ++i) {
+        SkAAClip clip;
+        clip.setPath(path, NULL, 1 == i);
+        
+        SkMask mask;
+        clip.copyToMask(&mask);
+        
+        REPORTER_ASSERT(reporter, expected == mask);
+    }
+}
+
 static void TestAAClip(skiatest::Reporter* reporter) {
     test_empty(reporter);
     test_path_bounds(reporter);
     test_irect(reporter);
     test_rgn(reporter);
+    test_path_with_hole(reporter);
 }
 
 #include "TestClassDef.h"