diff options
author | Brian Salomon <bsalomon@google.com> | 2017-12-05 10:35:15 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-05 15:56:01 +0000 |
commit | 1447177005fcbac83acd501766a46c751a49ae73 (patch) | |
tree | ed20f7b0984a3a0f01e0d46465c4fda98bb49802 /tests/ClipStackTest.cpp | |
parent | bb4b20a265a78b561c005aaf80920d4bc9c2e7d0 (diff) |
Avoid GrEllipseEffect for small radii on devices without 32 bit float.
Also limit small radius bail in GrCircleEffect to clip out cases.
Change-Id: I14ce736969b05203219d68f30283c36c84f78f3a
Reviewed-on: https://skia-review.googlesource.com/80621
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/ClipStackTest.cpp')
-rw-r--r-- | tests/ClipStackTest.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 554362372d..fe24bc14e6 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -1019,6 +1019,9 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { } } + auto context = GrContext::MakeMock(nullptr); + const auto* caps = context->caps()->shaderCaps(); + // Zero the memory we will new the GrReducedClip into. This ensures the elements gen ID // will be kInvalidGenID if left uninitialized. SkAlignedSTStorage<1, GrReducedClip> storage; @@ -1028,7 +1031,7 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { // Get the reduced version of the stack. SkRect queryBounds = kBounds; queryBounds.outset(kBounds.width() / 2, kBounds.height() / 2); - const GrReducedClip* reduced = new (storage.get()) GrReducedClip(stack, queryBounds); + const GrReducedClip* reduced = new (storage.get()) GrReducedClip(stack, queryBounds, caps); REPORTER_ASSERT_MESSAGE(reporter, reduced->maskElements().isEmpty() || @@ -1087,10 +1090,13 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { kReplace_SkClipOp, true); SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); + auto context = GrContext::MakeMock(nullptr); + const auto* caps = context->caps()->shaderCaps(); + SkAlignedSTStorage<1, GrReducedClip> storage; memset(storage.get(), 0, sizeof(GrReducedClip)); GR_STATIC_ASSERT(0 == SkClipStack::kInvalidGenID); - const GrReducedClip* reduced = new (storage.get()) GrReducedClip(stack, bounds); + const GrReducedClip* reduced = new (storage.get()) GrReducedClip(stack, bounds, caps); REPORTER_ASSERT(reporter, reduced->maskElements().count() == 1); // Clips will be cached based on the generation id. Make sure the gen id is valid. @@ -1173,9 +1179,11 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { #undef XYWH #undef IXYWH + auto context = GrContext::MakeMock(nullptr); + const auto* caps = context->caps()->shaderCaps(); for (size_t i = 0; i < SK_ARRAY_COUNT(testCases); ++i) { - const GrReducedClip reduced(stack, testCases[i].testBounds); + const GrReducedClip reduced(stack, testCases[i].testBounds, caps); REPORTER_ASSERT(reporter, reduced.maskElements().count() == testCases[i].reducedClipCount); SkASSERT(reduced.maskElements().count() == testCases[i].reducedClipCount); @@ -1199,8 +1207,11 @@ static void test_reduced_clip_stack_no_aa_crash(skiatest::Reporter* reporter) { stack.clipDevRect(SkIRect::MakeXYWH(0, 0, 50, 50), kReplace_SkClipOp); SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); + auto context = GrContext::MakeMock(nullptr); + const auto* caps = context->caps()->shaderCaps(); + // At the time, this would crash. - const GrReducedClip reduced(stack, bounds); + const GrReducedClip reduced(stack, bounds, caps); REPORTER_ASSERT(reporter, reduced.maskElements().isEmpty()); } @@ -1215,9 +1226,12 @@ static void test_aa_query(skiatest::Reporter* reporter, const SkString& testName const SkClipStack& stack, const SkMatrix& queryXform, const SkRect& preXformQuery, ClipMethod expectedMethod, int numExpectedElems = 0) { + auto context = GrContext::MakeMock(nullptr); + const auto* caps = context->caps()->shaderCaps(); + SkRect queryBounds; queryXform.mapRect(&queryBounds, preXformQuery); - const GrReducedClip reduced(stack, queryBounds); + const GrReducedClip reduced(stack, queryBounds, caps); SkClipStack::BoundsType stackBoundsType; SkRect stackBounds; @@ -1377,12 +1391,15 @@ static void test_tiny_query_bounds_assertion_bug(skiatest::Reporter* reporter) { SkClipStack pathStack; pathStack.clipPath(clipPath, SkMatrix::I(), kIntersect_SkClipOp, true); + auto context = GrContext::MakeMock(nullptr); + const auto* caps = context->caps()->shaderCaps(); + for (const SkClipStack& stack : {rectStack, pathStack}) { for (SkRect queryBounds : {SkRect::MakeXYWH(53, 60, GrClip::kBoundsTolerance, 1000), SkRect::MakeXYWH(53, 60, GrClip::kBoundsTolerance/2, 1000), SkRect::MakeXYWH(53, 160, 1000, GrClip::kBoundsTolerance), SkRect::MakeXYWH(53, 160, 1000, GrClip::kBoundsTolerance/2)}) { - const GrReducedClip reduced(stack, queryBounds); + const GrReducedClip reduced(stack, queryBounds, caps); REPORTER_ASSERT(reporter, !reduced.hasScissor()); REPORTER_ASSERT(reporter, reduced.maskElements().isEmpty()); REPORTER_ASSERT(reporter, |