@@ -2193,6 +2193,77 @@ TEST_P(AiksTest, StrokedCirclesRenderCorrectly) {
21932193 ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
21942194}
21952195
2196+ TEST_P (AiksTest, FilledEllipsesRenderCorrectly) {
2197+ Canvas canvas;
2198+ canvas.Scale (GetContentScale ());
2199+ Paint paint;
2200+ const int color_count = 3 ;
2201+ Color colors[color_count] = {
2202+ Color::Blue (),
2203+ Color::Green (),
2204+ Color::Crimson (),
2205+ };
2206+
2207+ paint.color = Color::White ();
2208+ canvas.DrawPaint (paint);
2209+
2210+ int c_index = 0 ;
2211+ int long_radius = 600 ;
2212+ int short_radius = 600 ;
2213+ while (long_radius > 0 && short_radius > 0 ) {
2214+ paint.color = colors[(c_index++) % color_count];
2215+ canvas.DrawOval (Rect::MakeXYWH (10 - long_radius, 10 - short_radius,
2216+ long_radius * 2 , short_radius * 2 ),
2217+ paint);
2218+ canvas.DrawOval (Rect::MakeXYWH (1000 - short_radius, 750 - long_radius,
2219+ short_radius * 2 , long_radius * 2 ),
2220+ paint);
2221+ if (short_radius > 30 ) {
2222+ short_radius -= 10 ;
2223+ long_radius -= 5 ;
2224+ } else {
2225+ short_radius -= 2 ;
2226+ long_radius -= 1 ;
2227+ }
2228+ }
2229+
2230+ std::vector<Color> gradient_colors = {
2231+ Color{0x1f / 255.0 , 0.0 , 0x5c / 255.0 , 1.0 },
2232+ Color{0x5b / 255.0 , 0.0 , 0x60 / 255.0 , 1.0 },
2233+ Color{0x87 / 255.0 , 0x01 / 255.0 , 0x60 / 255.0 , 1.0 },
2234+ Color{0xac / 255.0 , 0x25 / 255.0 , 0x53 / 255.0 , 1.0 },
2235+ Color{0xe1 / 255.0 , 0x6b / 255.0 , 0x5c / 255.0 , 1.0 },
2236+ Color{0xf3 / 255.0 , 0x90 / 255.0 , 0x60 / 255.0 , 1.0 },
2237+ Color{0xff / 255.0 , 0xb5 / 255.0 , 0x6b / 250.0 , 1.0 }};
2238+ std::vector<Scalar> stops = {
2239+ 0.0 ,
2240+ (1.0 / 6.0 ) * 1 ,
2241+ (1.0 / 6.0 ) * 2 ,
2242+ (1.0 / 6.0 ) * 3 ,
2243+ (1.0 / 6.0 ) * 4 ,
2244+ (1.0 / 6.0 ) * 5 ,
2245+ 1.0 ,
2246+ };
2247+ auto texture = CreateTextureForFixture (" airplane.jpg" ,
2248+ /* enable_mipmapping=*/ true );
2249+
2250+ paint.color = Color::White ().WithAlpha (0.5 );
2251+
2252+ paint.color_source = ColorSource::MakeRadialGradient (
2253+ {300 , 650 }, 75 , std::move (gradient_colors), std::move (stops),
2254+ Entity::TileMode::kMirror , {});
2255+ canvas.DrawOval (Rect::MakeXYWH (200 , 625 , 200 , 50 ), paint);
2256+ canvas.DrawOval (Rect::MakeXYWH (275 , 550 , 50 , 200 ), paint);
2257+
2258+ paint.color_source = ColorSource::MakeImage (
2259+ texture, Entity::TileMode::kRepeat , Entity::TileMode::kRepeat , {},
2260+ Matrix::MakeTranslation ({610 , 15 }));
2261+ canvas.DrawOval (Rect::MakeXYWH (610 , 90 , 200 , 50 ), paint);
2262+ canvas.DrawOval (Rect::MakeXYWH (685 , 15 , 50 , 200 ), paint);
2263+
2264+ ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
2265+ }
2266+
21962267TEST_P (AiksTest, GradientStrokesRenderCorrectly) {
21972268 // Compare with https://fiddle.skia.org/c/027392122bec8ac2b5d5de00a4b9bbe2
21982269 auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
0 commit comments