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
This commit is contained in:
junov@chromium.org 2012-12-10 14:57:54 +00:00
Родитель 0d3d09e5d2
Коммит edf32d5b0e
2 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -541,7 +541,7 @@ void SkClipStack::clipDevRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
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);
}

Просмотреть файл

@ -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