@@ -1860,5 +1860,36 @@ TEST_P(DisplayListTest,
18601860 EXPECT_EQ (it->second .coverage_union , Rect::MakeLTRB (10 , 20 , 60 , 80 ));
18611861}
18621862
1863+ TEST_P (DisplayListTest,
1864+ FirstPassDispatcherSaveLayerMaximalBoundsDoesNotClipCullRect) {
1865+ auto blur =
1866+ flutter::DlImageFilter::MakeBlur (10 , 10 , flutter::DlTileMode::kClamp );
1867+ // A perspective transform where homogeneous coordinates (w) flip sign for
1868+ // distant points if maximal bounds are transformed.
1869+ Matrix transform (1 .0f , 0 .0f , 0 .0f , 0 .0001f , //
1870+ 0 .0f , 1 .0f , 0 .0f , 0 .0f , //
1871+ 0 .0f , 0 .0f , 1 .0f , 0 .0f , //
1872+ 0 .0f , 0 .0f , 0 .0f , 1 .0f );
1873+ FirstPassDispatcher collector (GetContentContext (), transform,
1874+ Rect::MakeLTRB (0 , 0 , 1000 , 1000 ));
1875+ flutter::SaveLayerOptions options;
1876+ options = options.with_bounds_from_caller ();
1877+
1878+ // Maximal bounds with bounds_from_caller.
1879+ collector.saveLayer (DlRect::MakeMaximum (), options, nullptr , std::nullopt );
1880+ // Inner layer with backdrop filter.
1881+ collector.saveLayer (DlRect (), flutter::SaveLayerOptions (), blur.get (),
1882+ /* backdrop_id=*/ 1 );
1883+ collector.restore ();
1884+ collector.restore ();
1885+
1886+ auto [backdrop_data, backdrop_count] = collector.TakeBackdropData ();
1887+ EXPECT_EQ (backdrop_count, 1u );
1888+ auto it = backdrop_data.find (1 );
1889+ ASSERT_TRUE (it != backdrop_data.end ());
1890+ EXPECT_FALSE (it->second .coverage_union .IsEmpty ());
1891+ EXPECT_EQ (it->second .coverage_union , Rect::MakeLTRB (0 , 0 , 1000 , 1000 ));
1892+ }
1893+
18631894} // namespace testing
18641895} // namespace impeller
0 commit comments