Skip to content

Commit

Permalink
Apply the offset to the child bounds of an ImageFilterLayer with no f…
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Jul 19, 2023
1 parent d30ec5a commit 58f8ea3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions flow/layers/image_filter_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void ImageFilterLayer::Preroll(PrerollContext* context) {
PrerollChildren(context, &child_bounds);

if (!filter_) {
child_bounds.offset(offset_);
set_paint_bounds(child_bounds);
return;
}
Expand Down
13 changes: 13 additions & 0 deletions flow/layers/image_filter_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,19 @@ TEST_F(ImageFilterLayerDiffTest, ImageFilterLayerInflatestChildSize) {
EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(40, 40, 170, 170));
}

TEST_F(ImageFilterLayerTest, EmptyFilterWithOffset) {
const SkRect child_bounds = SkRect::MakeLTRB(10.0f, 11.0f, 19.0f, 20.0f);
const SkPath child_path = SkPath().addRect(child_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
const SkPoint offset = SkPoint::Make(5.0f, 6.0f);
auto layer = std::make_shared<ImageFilterLayer>(nullptr, offset);
layer->Add(mock_layer);

layer->Preroll(preroll_context());
EXPECT_EQ(layer->paint_bounds(), child_bounds.makeOffset(offset));
}

} // namespace testing
} // namespace flutter

Expand Down

0 comments on commit 58f8ea3

Please sign in to comment.