From b8fa2abc46f9fc48a04b655a0bc40e25d220206b Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Thu, 19 Jan 2023 17:59:53 -0800 Subject: [PATCH] [Impeller] Check the correct stencil coverage when deciding whether to elide a restore --- impeller/aiks/aiks_unittests.cc | 4 ++-- impeller/entity/entity_pass.cc | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/impeller/aiks/aiks_unittests.cc b/impeller/aiks/aiks_unittests.cc index 2485772e30f58..dc884f85ee252 100644 --- a/impeller/aiks/aiks_unittests.cc +++ b/impeller/aiks/aiks_unittests.cc @@ -278,11 +278,11 @@ TEST_P(AiksTest, CanRenderWithContiguousClipRestores) { canvas.Save(); - // Append two clips. First with empty coverage. + // Append two clips, the second resulting in empty coverage. canvas.ClipPath( PathBuilder{}.AddRect(Rect::MakeXYWH(100, 100, 100, 100)).TakePath()); canvas.ClipPath( - PathBuilder{}.AddRect(Rect::MakeXYWH(100, 100, 100, 100)).TakePath()); + PathBuilder{}.AddRect(Rect::MakeXYWH(300, 300, 100, 100)).TakePath()); // Restore to no clips. canvas.Restore(); diff --git a/impeller/entity/entity_pass.cc b/impeller/entity/entity_pass.cc index 581974069e177..0add3a2264084 100644 --- a/impeller/entity/entity_pass.cc +++ b/impeller/entity/entity_pass.cc @@ -460,10 +460,9 @@ bool EntityPass::OnRender( element_entity.GetStencilDepth() - stencil_depth_floor; FML_DCHECK(restoration_depth < stencil_stack.size()); - auto restored_coverage = stencil_stack.back().coverage; stencil_stack.resize(restoration_depth + 1); - if (!restored_coverage.has_value()) { + if (!stencil_stack.back().coverage.has_value()) { // Running this restore op won't make anything renderable, so skip it. return true; }