Reland "Avoid expanding clip ops in tests that will remain after feature removal"

This reverts commit b942d4b436.

Reason for revert: dependent cl no longer blocking android roll, so 
this can be relanded.

Original change's description:
> Revert "Avoid expanding clip ops in tests that will remain after feature removal"
>
> This reverts commit d1c51b2572.
>
> Reason for revert: blocking revert that might be breaking android
>
> Original change's description:
> > Avoid expanding clip ops in tests that will remain after feature removal
> >
> > Bug: skia:10208
> > Change-Id: I4fb2c8181bfb8cac3c8ab95c833094c98f8ee6fc
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436159
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=robertphillips@google.com,reed@google.com,michaelludwig@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com
>
> Change-Id: Ib62cc03f99793f8f1cb0180145b7557101a23ead
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10208
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/436957
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

# Not skipping CQ checks because this is a reland.

Bug: skia:10208
Change-Id: Iff6e5b2b245426a76b92e895434613fe16ba717c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437277
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
Michael Ludwig 2021-08-06 10:42:01 -04:00 committed by SkCQ
parent 6fbcd8e603
commit a3a67ae303

View File

@ -63,16 +63,16 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) {
s.save(); s.save();
REPORTER_ASSERT(reporter, 2 == s.getSaveCount()); REPORTER_ASSERT(reporter, 2 == s.getSaveCount());
SkRect r = SkRect::MakeLTRB(1, 2, 3, 4); SkRect r = SkRect::MakeLTRB(1, 2, 103, 104);
s.clipRect(r, SkMatrix::I(), SkClipOp::kIntersect, doAA); s.clipRect(r, SkMatrix::I(), SkClipOp::kIntersect, doAA);
r = SkRect::MakeLTRB(10, 11, 12, 13); r = SkRect::MakeLTRB(4, 5, 56, 57);
s.clipRect(r, SkMatrix::I(), SkClipOp::kIntersect, doAA); s.clipRect(r, SkMatrix::I(), SkClipOp::kIntersect, doAA);
s.save(); s.save();
REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); REPORTER_ASSERT(reporter, 3 == s.getSaveCount());
r = SkRect::MakeLTRB(14, 15, 16, 17); r = SkRect::MakeLTRB(14, 15, 16, 17);
s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA); s.clipRect(r, SkMatrix::I(), SkClipOp::kDifference, doAA);
// Test that assignment works. // Test that assignment works.
SkClipStack copy = s; SkClipStack copy = s;
@ -87,7 +87,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) {
s.save(); s.save();
REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); REPORTER_ASSERT(reporter, 3 == s.getSaveCount());
r = SkRect::MakeLTRB(14, 15, 16, 17); r = SkRect::MakeLTRB(14, 15, 16, 17);
s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA); s.clipRect(r, SkMatrix::I(), SkClipOp::kDifference, doAA);
REPORTER_ASSERT(reporter, s == copy); REPORTER_ASSERT(reporter, s == copy);
// Test that a different op on one level triggers not equal. // Test that a different op on one level triggers not equal.
@ -104,7 +104,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) {
s.save(); s.save();
SkPath rp; SkPath rp;
rp.addRect(r); rp.addRect(r);
s.clipPath(rp, SkMatrix::I(), kUnion_SkClipOp, doAA); s.clipPath(rp, SkMatrix::I(), SkClipOp::kDifference, doAA);
REPORTER_ASSERT(reporter, s == copy); REPORTER_ASSERT(reporter, s == copy);
// Test that different rects triggers not equal. // Test that different rects triggers not equal.
@ -114,7 +114,7 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, 3 == s.getSaveCount()); REPORTER_ASSERT(reporter, 3 == s.getSaveCount());
r = SkRect::MakeLTRB(24, 25, 26, 27); r = SkRect::MakeLTRB(24, 25, 26, 27);
s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA); s.clipRect(r, SkMatrix::I(), SkClipOp::kDifference, doAA);
REPORTER_ASSERT(reporter, s != copy); REPORTER_ASSERT(reporter, s != copy);
s.restore(); s.restore();
@ -163,8 +163,8 @@ static void test_iterators(skiatest::Reporter* reporter) {
}; };
for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) { for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) {
// the union op will prevent these from being fused together // the difference op will prevent these from being fused together
stack.clipRect(gRects[i], SkMatrix::I(), kUnion_SkClipOp, false); stack.clipRect(gRects[i], SkMatrix::I(), SkClipOp::kDifference, false);
} }
assert_count(reporter, stack, 4); assert_count(reporter, stack, 4);
@ -207,7 +207,7 @@ static void test_iterators(skiatest::Reporter* reporter) {
SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart); SkClipStack::Iter iter(stack, SkClipStack::Iter::kBottom_IterStart);
element = iter.skipToTopmost(kUnion_SkClipOp); element = iter.skipToTopmost(SkClipOp::kDifference);
REPORTER_ASSERT(reporter, SkClipStack::Element::DeviceSpaceType::kRect == REPORTER_ASSERT(reporter, SkClipStack::Element::DeviceSpaceType::kRect ==
element->getDeviceSpaceType()); element->getDeviceSpaceType());
REPORTER_ASSERT(reporter, element->getDeviceSpaceRect() == gRects[3]); REPORTER_ASSERT(reporter, element->getDeviceSpaceRect() == gRects[3]);
@ -1368,7 +1368,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) {
name.printf("Complex clip test, iter %i", i); name.printf("Complex clip test, iter %i", i);
stack.reset(); stack.reset();
stack.clipRect(rect, SkMatrix::I(), SkClipOp::kIntersect, true); stack.clipRect(rect, SkMatrix::I(), SkClipOp::kIntersect, true);
stack.clipRect(innerRect, SkMatrix::I(), kXOR_SkClipOp, true); stack.clipRect(innerRect, SkMatrix::I(), SkClipOp::kDifference, true);
test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw); test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw);
test_aa_query(reporter, name, stack, m, {r-.1f, t, R, b}, ClipMethod::kAAElements, 1); test_aa_query(reporter, name, stack, m, {r-.1f, t, R, b}, ClipMethod::kAAElements, 1);
test_aa_query(reporter, name, stack, m, {r-.1f, t, R+.1f, b}, ClipMethod::kAAElements, 2); test_aa_query(reporter, name, stack, m, {r-.1f, t, R+.1f, b}, ClipMethod::kAAElements, 2);
@ -1380,7 +1380,7 @@ static void test_reduced_clip_stack_aa(skiatest::Reporter* reporter) {
name.printf("Aligned Complex clip test, iter %i", i); name.printf("Aligned Complex clip test, iter %i", i);
stack.reset(); stack.reset();
stack.clipRect(alignedRect, SkMatrix::I(), SkClipOp::kIntersect, true); stack.clipRect(alignedRect, SkMatrix::I(), SkClipOp::kIntersect, true);
stack.clipRect(innerRect, SkMatrix::I(), kXOR_SkClipOp, true); stack.clipRect(innerRect, SkMatrix::I(), SkClipOp::kDifference, true);
test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw); test_aa_query(reporter, name, stack, m, {l, t, r, b}, ClipMethod::kSkipDraw);
test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB}, ClipMethod::kAAElements, 1); test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB}, ClipMethod::kAAElements, 1);
test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB+.1f}, ClipMethod::kAAElements, 1); test_aa_query(reporter, name, stack, m, {l, b-.1f, r, IB+.1f}, ClipMethod::kAAElements, 1);