mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Apply the offset to the child bounds of an ImageFilterLayer with no filter (flutter/engine#43783)
Fixes https://github.com/flutter/flutter/issues/130318
This commit is contained in:
parent
885df86099
commit
a4e0000a77
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user