Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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
8 changes: 8 additions & 0 deletions impeller/aiks/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ void Canvas::SaveLayer(const Paint& paint,
const std::shared_ptr<ImageFilter>& backdrop_filter) {
Save(true, paint.blend_mode, backdrop_filter);

// The DisplayList bounds/rtree doesn't account for filters applied to parent
// layers, and so sub-DisplayLists are getting culled as if no filters are
// applied.
// See also: https://github.com/flutter/flutter/issues/139294
if (paint.image_filter) {
xformation_stack_.back().cull_rect = std::nullopt;
}

auto& new_layer_pass = GetCurrentPass();
new_layer_pass.SetBoundsLimit(bounds);

Expand Down
18 changes: 18 additions & 0 deletions impeller/aiks/canvas_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "flutter/testing/testing.h"
#include "impeller/aiks/canvas.h"
#include "impeller/aiks/image_filter.h"
#include "impeller/geometry/path_builder.h"

// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
Expand Down Expand Up @@ -336,6 +337,23 @@ TEST(AiksCanvasTest, PathClipDiffAgainstFullyCoveredCullRect) {
ASSERT_EQ(canvas.GetCurrentLocalCullingBounds().value(), result_cull);
}

TEST(AiksCanvasTest, DisableLocalBoundsRectForFilteredSaveLayers) {
Rect initial_cull = Rect::MakeXYWH(0, 0, 10, 10);

Canvas canvas(initial_cull);
ASSERT_TRUE(canvas.GetCurrentLocalCullingBounds().has_value());

canvas.Save();
canvas.SaveLayer(
Paint{.image_filter = ImageFilter::MakeBlur(
Sigma(10), Sigma(10), FilterContents::BlurStyle::kNormal,
Entity::TileMode::kDecal)});
ASSERT_FALSE(canvas.GetCurrentLocalCullingBounds().has_value());

canvas.Restore();
ASSERT_TRUE(canvas.GetCurrentLocalCullingBounds().has_value());
}

} // namespace testing
} // namespace impeller

Expand Down