@@ -1102,6 +1102,76 @@ TEST_P(AiksTest, PaintBlendModeIsRespected) {
11021102 ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
11031103}
11041104
1105+ // This makes sure the WideGamut named tests use 16bit float pixel format.
1106+ TEST_P (AiksTest, F16WideGamut) {
1107+ if (GetParam () != PlaygroundBackend::kMetal ) {
1108+ GTEST_SKIP_ (" This backend doesn't yet support wide gamut." );
1109+ }
1110+ EXPECT_EQ (GetContext ()->GetCapabilities ()->GetDefaultColorFormat (),
1111+ PixelFormat::kR16G16B16A16Float );
1112+ EXPECT_FALSE (IsAlphaClampedToOne (
1113+ GetContext ()->GetCapabilities ()->GetDefaultColorFormat ()));
1114+ }
1115+
1116+ TEST_P (AiksTest, NotF16) {
1117+ EXPECT_TRUE (IsAlphaClampedToOne (
1118+ GetContext ()->GetCapabilities ()->GetDefaultColorFormat ()));
1119+ }
1120+
1121+ // Bug: https://github.com/flutter/flutter/issues/142549
1122+ TEST_P (AiksTest, BlendModePlusAlphaWideGamut) {
1123+ if (GetParam () != PlaygroundBackend::kMetal ) {
1124+ GTEST_SKIP_ (" This backend doesn't yet support wide gamut." );
1125+ }
1126+ EXPECT_EQ (GetContext ()->GetCapabilities ()->GetDefaultColorFormat (),
1127+ PixelFormat::kR16G16B16A16Float );
1128+ auto texture = CreateTextureForFixture (" airplane.jpg" ,
1129+ /* enable_mipmapping=*/ true );
1130+
1131+ Canvas canvas;
1132+ canvas.Scale (GetContentScale ());
1133+ canvas.DrawPaint ({.color = Color (0.9 , 1.0 , 0.9 , 1.0 )});
1134+ canvas.SaveLayer ({});
1135+ Paint paint;
1136+ paint.blend_mode = BlendMode::kPlus ;
1137+ paint.color = Color::Red ();
1138+ canvas.DrawRect (Rect::MakeXYWH (100 , 100 , 400 , 400 ), paint);
1139+ paint.color = Color::White ();
1140+ canvas.DrawImageRect (
1141+ std::make_shared<Image>(texture), Rect::MakeSize (texture->GetSize ()),
1142+ Rect::MakeXYWH (100 , 100 , 400 , 400 ).Expand (-100 , -100 ), paint);
1143+ canvas.Restore ();
1144+ ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
1145+ }
1146+
1147+ // Bug: https://github.com/flutter/flutter/issues/142549
1148+ TEST_P (AiksTest, BlendModePlusAlphaColorFilterWideGamut) {
1149+ if (GetParam () != PlaygroundBackend::kMetal ) {
1150+ GTEST_SKIP_ (" This backend doesn't yet support wide gamut." );
1151+ }
1152+ EXPECT_EQ (GetContext ()->GetCapabilities ()->GetDefaultColorFormat (),
1153+ PixelFormat::kR16G16B16A16Float );
1154+ auto texture = CreateTextureForFixture (" airplane.jpg" ,
1155+ /* enable_mipmapping=*/ true );
1156+
1157+ Canvas canvas;
1158+ canvas.Scale (GetContentScale ());
1159+ canvas.DrawPaint ({.color = Color (0.1 , 0.2 , 0.1 , 1.0 )});
1160+ canvas.SaveLayer ({
1161+ .color_filter =
1162+ ColorFilter::MakeBlend (BlendMode::kPlus , Color (Vector4{1 , 0 , 0 , 1 })),
1163+ });
1164+ Paint paint;
1165+ paint.color = Color::Red ();
1166+ canvas.DrawRect (Rect::MakeXYWH (100 , 100 , 400 , 400 ), paint);
1167+ paint.color = Color::White ();
1168+ canvas.DrawImageRect (
1169+ std::make_shared<Image>(texture), Rect::MakeSize (texture->GetSize ()),
1170+ Rect::MakeXYWH (100 , 100 , 400 , 400 ).Expand (-100 , -100 ), paint);
1171+ canvas.Restore ();
1172+ ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
1173+ }
1174+
11051175TEST_P (AiksTest, ColorWheel) {
11061176 // Compare with https://fiddle.skia.org/c/@BlendModes
11071177
0 commit comments