Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add unit test.
  • Loading branch information
jonahwilliams committed Jan 24, 2024
commit 19bbfad9521630973d346faf164e3ac66f593d46
23 changes: 23 additions & 0 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3864,5 +3864,28 @@ TEST_P(AiksTest, GaussianBlurMipMapImageFilter) {
#endif
}

TEST_P(AiksTest, SaveLayersCloseToRootPassSizeAreScaledUp) {
Canvas canvas;
canvas.SaveLayer(
{
.color = Color::Black().WithAlpha(0.5),
},
Rect::MakeSize(ISize(95, 95)));
canvas.DrawRect(Rect::MakeLTRB(0, 0, 100, 100), {.color = Color::Red()});
canvas.DrawRect(Rect::MakeLTRB(50, 50, 150, 150), {.color = Color::Blue()});
canvas.Restore();

Picture picture = canvas.EndRecordingAsPicture();
std::shared_ptr<RenderTargetCache> cache =
std::make_shared<RenderTargetCache>(GetContext()->GetResourceAllocator());
AiksContext aiks_context(GetContext(), nullptr, cache);
picture.ToImage(aiks_context, {100, 100});

for (auto it = cache->GetTextureDataBegin(); it != cache->GetTextureDataEnd();
++it) {
EXPECT_EQ(it->texture->GetTextureDescriptor().size, ISize(100, 100));
}
}

} // namespace testing
} // namespace impeller