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

Commit d09eba1

Browse files
committed
Address comments
1 parent 993e850 commit d09eba1

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3639,7 +3639,26 @@ TEST_P(AiksTest, MatrixImageFilterDoesntCullWhenTranslatedFromOffscreen) {
36393639
.image_filter = std::make_shared<MatrixImageFilter>(
36403640
Matrix::MakeTranslation({300, 0}), SamplerDescriptor{}),
36413641
});
3642-
canvas.DrawCircle({-300, 0}, 100, {.color = Color::White()});
3642+
canvas.DrawCircle({-300, 0}, 100, {.color = Color::Green()});
3643+
canvas.Restore();
3644+
3645+
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
3646+
}
3647+
3648+
// Render a white circle at the top left corner of the screen.
3649+
TEST_P(AiksTest,
3650+
MatrixImageFilterDoesntCullWhenScaledAndTranslatedFromOffscreen) {
3651+
Canvas canvas;
3652+
canvas.Scale(GetContentScale());
3653+
canvas.Translate({100, 100});
3654+
// Draw a circle in a SaveLayer at -300, but move it back on-screen with a
3655+
// +300 translation applied by a SaveLayer image filter.
3656+
canvas.SaveLayer({
3657+
.image_filter = std::make_shared<MatrixImageFilter>(
3658+
Matrix::MakeTranslation({300, 0}) * Matrix::MakeScale({2, 2, 2}),
3659+
SamplerDescriptor{}),
3660+
});
3661+
canvas.DrawCircle({-150, 0}, 50, {.color = Color::Green()});
36433662
canvas.Restore();
36443663

36453664
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));

impeller/entity/entity_pass.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,9 @@ EntityPass::EntityResult EntityPass::GetEntityForElement(
641641

642642
// Start non-collapsed subpasses with a fresh clip coverage stack limited by
643643
// the subpass coverage. This is important because image filters applied to
644-
// save layers may transform the subpass texture after its rendered, causing
645-
// parent clip coverage to get misaligned with the actual area that the
646-
// subpass will affect in the parent pass.
644+
// save layers may transform the subpass texture after it's rendered,
645+
// causing parent clip coverage to get misaligned with the actual area that
646+
// the subpass will affect in the parent pass.
647647
ClipCoverageStack subpass_clip_coverage_stack = {ClipCoverageLayer{
648648
.coverage = subpass_coverage, .clip_depth = subpass->clip_depth_}};
649649

impeller/entity/entity_pass.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,16 @@ class EntityPass {
142142
void SetEnableOffscreenCheckerboard(bool enabled);
143143

144144
//----------------------------------------------------------------------------
145-
/// @brief Get the coverage of an unfiltered subpass.
145+
/// @brief Computes the coverage of a given subpass. This is used to
146+
/// determine the texture size of a given subpass before it's rendered
147+
/// to and passed through the subpass ImageFilter, if any.
148+
///
149+
/// @param[in] subpass The EntityPass for which to compute
150+
/// pre-filteredcoverage.
151+
/// @param[in] coverage_limit Confines coverage to a specified area. This
152+
/// hint is used to trim coverage to the root
153+
/// framebuffer area. `std::nullopt` means no
154+
/// coverage.
146155
///
147156
std::optional<Rect> GetSubpassCoverage(
148157
const EntityPass& subpass,

0 commit comments

Comments
 (0)