@@ -2763,28 +2763,56 @@ TEST_P(AiksTest, TranslucentSaveLayerWithColorAndImageFilterDrawsCorrectly) {
27632763TEST_P (AiksTest, ImageFilteredSaveLayerWithUnboundedContents) {
27642764 Canvas canvas;
27652765
2766- auto texture = CreateTextureForFixture (" airplane.jpg" );
2767- auto blur_filter = ImageFilter::MakeBlur (Sigma{5.0 }, Sigma{5.0 },
2766+ auto blur_filter = ImageFilter::MakeBlur (Sigma{10.0 }, Sigma{10.0 },
27682767 FilterContents::BlurStyle::kNormal ,
2769- Entity::TileMode::kClamp );
2770- auto image_source = ColorSource::MakeImage (texture, Entity::TileMode::kRepeat ,
2771- Entity::TileMode::kRepeat , {}, {});
2768+ Entity::TileMode::kDecal );
2769+
2770+ auto DrawLine = [&canvas](const Point& p0, const Point& p1, const Paint& p) {
2771+ auto path = PathBuilder{}
2772+ .AddLine (p0, p1)
2773+ .SetConvexity (Convexity::kConvex )
2774+ .TakePath ();
2775+ Paint paint = p;
2776+ paint.style = Paint::Style::kStroke ;
2777+ canvas.DrawPath (path, paint);
2778+ };
2779+ // Registration marks for the edge of the SaveLayer
2780+ DrawLine (Point (75 , 100 ), Point (225 , 100 ), {.color = Color::White ()});
2781+ DrawLine (Point (75 , 200 ), Point (225 , 200 ), {.color = Color::White ()});
2782+ DrawLine (Point (100 , 75 ), Point (100 , 225 ), {.color = Color::White ()});
2783+ DrawLine (Point (200 , 75 ), Point (200 , 225 ), {.color = Color::White ()});
27722784
27732785 canvas.SaveLayer ({.image_filter = blur_filter},
27742786 Rect::MakeLTRB (100 , 100 , 200 , 200 ));
2787+ {
2788+ // DrawPaint to verify correct behavior when the contents are unbounded.
2789+ canvas.DrawPaint ({.color = Color::Yellow ()});
2790+
2791+ // Contrasting rectangle to see interior blurring
2792+ canvas.DrawRect (Rect::MakeLTRB (125 , 125 , 175 , 175 ),
2793+ {.color = Color::Blue ()});
2794+ }
2795+ canvas.Restore ();
27752796
2776- canvas.DrawPaint ({.color_source = image_source});
2797+ ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
2798+ }
27772799
2778- Paint blue = {. color = Color::Blue ()};
2779- Paint green = {. color = Color::Green ()} ;
2800+ TEST_P (AiksTest, ImageFilteredUnboundedSaveLayerWithUnboundedContents) {
2801+ Canvas canvas ;
27802802
2781- canvas.DrawRect (Rect::MakeLTRB (125 , 125 , 175 , 175 ), blue);
2803+ auto blur_filter = ImageFilter::MakeBlur (Sigma{10.0 }, Sigma{10.0 },
2804+ FilterContents::BlurStyle::kNormal ,
2805+ Entity::TileMode::kDecal );
27822806
2783- canvas.DrawRect ( Rect::MakeLTRB ( 125 , 50 , 175 , 98 ), green );
2784- canvas. DrawRect ( Rect::MakeLTRB ( 202 , 125 , 250 , 175 ), green);
2785- canvas. DrawRect ( Rect::MakeLTRB ( 125 , 202 , 175 , 250 ), green);
2786- canvas.DrawRect ( Rect::MakeLTRB ( 50 , 125 , 98 , 175 ), green );
2807+ canvas.SaveLayer ({. image_filter = blur_filter}, std:: nullopt );
2808+ {
2809+ // DrawPaint to verify correct behavior when the contents are unbounded.
2810+ canvas.DrawPaint ({. color = Color::Yellow ()} );
27872811
2812+ // Contrasting rectangle to see interior blurring
2813+ canvas.DrawRect (Rect::MakeLTRB (125 , 125 , 175 , 175 ),
2814+ {.color = Color::Blue ()});
2815+ }
27882816 canvas.Restore ();
27892817
27902818 ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
0 commit comments