aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ClipStackTest.cpp
diff options
context:
space:
mode:
authorGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 14:57:54 +0000
committerGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 14:57:54 +0000
commitedf32d5b0e7694833287024e03da38521a0adf05 (patch)
treee4d6dee0eeca975619fe9141c8f12f6f7fa3e51e /tests/ClipStackTest.cpp
parent0d3d09e5d2fd17aaed035ae23d59804b56b994ff (diff)
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
Diffstat (limited to 'tests/ClipStackTest.cpp')
-rw-r--r--tests/ClipStackTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index 9b4a68f694..03da7f18fe 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -375,6 +375,23 @@ static int count(const SkClipStack& stack) {
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 @@ static void TestClipStack(skiatest::Reporter* reporter) {
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