Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Check the correct stencil coverage when deciding whether to elide a restore #39023

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions impeller/entity/entity_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down