Skip to content

Commit b717cfa

Browse files
bderozanderso
authored andcommitted
[Impeller] Check the correct stencil coverage when deciding whether to elide a restore (flutter#39023)
1 parent b24591e commit b717cfa

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,11 @@ TEST_P(AiksTest, CanRenderWithContiguousClipRestores) {
273273

274274
canvas.Save();
275275

276-
// Append two clips. First with empty coverage.
276+
// Append two clips, the second resulting in empty coverage.
277277
canvas.ClipPath(
278278
PathBuilder{}.AddRect(Rect::MakeXYWH(100, 100, 100, 100)).TakePath());
279279
canvas.ClipPath(
280-
PathBuilder{}.AddRect(Rect::MakeXYWH(100, 100, 100, 100)).TakePath());
280+
PathBuilder{}.AddRect(Rect::MakeXYWH(300, 300, 100, 100)).TakePath());
281281

282282
// Restore to no clips.
283283
canvas.Restore();

impeller/entity/entity_pass.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,9 @@ bool EntityPass::OnRender(
460460
element_entity.GetStencilDepth() - stencil_depth_floor;
461461
FML_DCHECK(restoration_depth < stencil_stack.size());
462462

463-
auto restored_coverage = stencil_stack.back().coverage;
464463
stencil_stack.resize(restoration_depth + 1);
465464

466-
if (!restored_coverage.has_value()) {
465+
if (!stencil_stack.back().coverage.has_value()) {
467466
// Running this restore op won't make anything renderable, so skip it.
468467
return true;
469468
}

0 commit comments

Comments
 (0)