| Index: tests/ClipStackTest.cpp
|
| diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
|
| index 5265ac2c670a97c06f9044339020b90ec1196d7c..d1d636ae981d794066865d4c53455d64386ceab7 100644
|
| --- a/tests/ClipStackTest.cpp
|
| +++ b/tests/ClipStackTest.cpp
|
| @@ -1012,7 +1012,9 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) {
|
| queryBounds.outset(kBounds.width() / 2, kBounds.height() / 2);
|
| const GrReducedClip reduced(stack, queryBounds);
|
|
|
| - REPORTER_ASSERT_MESSAGE(reporter, SkClipStack::kInvalidGenID != reduced.genID(),
|
| + REPORTER_ASSERT_MESSAGE(reporter,
|
| + reduced.elements().isEmpty() ||
|
| + SkClipStack::kInvalidGenID != reduced.elementsGenID(),
|
| testCase.c_str());
|
|
|
| if (!reduced.elements().isEmpty()) {
|
| @@ -1023,7 +1025,8 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) {
|
| if (SkClipStack::kNormal_BoundsType == stackBoundsType) {
|
| // Unless GrReducedClip starts doing some heroic tightening of the clip bounds, this
|
| // will be true since the stack bounds are completely contained inside the query.
|
| - REPORTER_ASSERT_MESSAGE(reporter, GrClip::IsInsideClip(reduced.ibounds(), stackBounds),
|
| + REPORTER_ASSERT_MESSAGE(reporter,
|
| + GrClip::IsInsideClip(reduced.ibounds(), stackBounds),
|
| testCase.c_str());
|
| }
|
| REPORTER_ASSERT_MESSAGE(reporter, reduced.requiresAA() == doAA, testCase.c_str());
|
| @@ -1073,7 +1076,7 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) {
|
|
|
| REPORTER_ASSERT(reporter, reduced.elements().count() == 1);
|
| // Clips will be cached based on the generation id. Make sure the gen id is valid.
|
| - REPORTER_ASSERT(reporter, SkClipStack::kInvalidGenID != reduced.genID());
|
| + REPORTER_ASSERT(reporter, SkClipStack::kInvalidGenID != reduced.elementsGenID());
|
| }
|
| {
|
| SkClipStack stack;
|
| @@ -1115,30 +1118,30 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) {
|
| } testCases[] = {
|
|
|
| // Rect A.
|
| - { XYWH(0, 0, 25, 25), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 0, 25, 25) },
|
| - { XYWH(0.1f, 0.1f, 25.1f, 25.1f), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 0, 26, 26) },
|
| + { XYWH(0, 0, 25, 25), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 0, 25, 25) },
|
| + { XYWH(0.1f, 0.1f, 25.1f, 25.1f), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 0, 26, 26) },
|
| { XYWH(0, 0, 27, 27), 1, genIDA, GrReducedClip::InitialState::kAllOut, IXYWH(0, 0, 27, 27)},
|
|
|
| // Rect B.
|
| - { XYWH(50, 0, 25, 25), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 0, 25, 25) },
|
| - { XYWH(50, 0, 25.3f, 25.3f), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 0, 26, 26) },
|
| + { XYWH(50, 0, 25, 25), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 0, 25, 25) },
|
| + { XYWH(50, 0, 25.3f, 25.3f), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 0, 26, 26) },
|
| { XYWH(50, 0, 27, 27), 1, genIDB, GrReducedClip::InitialState::kAllOut, IXYWH(50, 0, 26, 27) },
|
|
|
| // Rect C.
|
| - { XYWH(0, 50, 25, 25), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 50, 25, 25) },
|
| - { XYWH(0.2f, 50.1f, 25.1f, 25.2f), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 50, 26, 26) },
|
| + { XYWH(0, 50, 25, 25), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 50, 25, 25) },
|
| + { XYWH(0.2f, 50.1f, 25.1f, 25.2f), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(0, 50, 26, 26) },
|
| { XYWH(0, 50, 27, 27), 1, genIDC, GrReducedClip::InitialState::kAllOut, IXYWH(0, 50, 27, 26) },
|
|
|
| // Rect D.
|
| - { XYWH(50, 50, 25, 25), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 50, 25, 25)},
|
| - { XYWH(50.3f, 50.3f, 25, 25), 0, SkClipStack::kWideOpenGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 50, 26, 26)},
|
| + { XYWH(50, 50, 25, 25), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 50, 25, 25)},
|
| + { XYWH(50.3f, 50.3f, 25, 25), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllIn, IXYWH(50, 50, 26, 26)},
|
| { XYWH(50, 50, 27, 27), 1, genIDD, GrReducedClip::InitialState::kAllOut, IXYWH(50, 50, 26, 26)},
|
|
|
| // Other tests:
|
| { XYWH(0, 0, 100, 100), 4, genIDD, GrReducedClip::InitialState::kAllOut, stackBounds },
|
|
|
| // Rect in the middle, touches none.
|
| - { XYWH(26, 26, 24, 24), 0, SkClipStack::kEmptyGenID, GrReducedClip::InitialState::kAllOut, IXYWH(26, 26, 24, 24) },
|
| + { XYWH(26, 26, 24, 24), 0, SkClipStack::kInvalidGenID, GrReducedClip::InitialState::kAllOut, IXYWH(26, 26, 24, 24) },
|
|
|
| // Rect in the middle, touches all the rects. GenID is the last rect.
|
| { XYWH(24, 24, 27, 27), 4, genIDD, GrReducedClip::InitialState::kAllOut, IXYWH(24, 24, 27, 27) },
|
| @@ -1151,8 +1154,10 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) {
|
| const GrReducedClip reduced(stack, testCases[i].testBounds);
|
| REPORTER_ASSERT(reporter, reduced.elements().count() == testCases[i].reducedClipCount);
|
| SkASSERT(reduced.elements().count() == testCases[i].reducedClipCount);
|
| - REPORTER_ASSERT(reporter, reduced.genID() == testCases[i].reducedGenID);
|
| - SkASSERT(reduced.genID() == testCases[i].reducedGenID);
|
| + if (reduced.elements().count()) {
|
| + REPORTER_ASSERT(reporter, reduced.elementsGenID() == testCases[i].reducedGenID);
|
| + SkASSERT(reduced.elementsGenID() == testCases[i].reducedGenID);
|
| + }
|
| REPORTER_ASSERT(reporter, reduced.initialState() == testCases[i].initialState);
|
| SkASSERT(reduced.initialState() == testCases[i].initialState);
|
| REPORTER_ASSERT(reporter, reduced.hasIBounds());
|
|
|