@@ -3073,6 +3073,42 @@ TEST_P(AiksTest, MipmapGenerationWorksCorrectly) {
30733073 ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
30743074}
30753075
3076+ TEST_P (AiksTest, DrawAtlasPlusWideGamut) {
3077+ if (GetParam () != PlaygroundBackend::kMetal ) {
3078+ GTEST_SKIP_ (" This backend doesn't yet support wide gamut." );
3079+ }
3080+
3081+ EXPECT_EQ (GetContext ()->GetCapabilities ()->GetDefaultColorFormat (),
3082+ PixelFormat::kR16G16B16A16Float );
3083+
3084+ // Draws the image as four squares stiched together.
3085+ auto atlas =
3086+ std::make_shared<Image>(CreateTextureForFixture (" bay_bridge.jpg" ));
3087+ auto size = atlas->GetSize ();
3088+ // Divide image into four quadrants.
3089+ Scalar half_width = size.width / 2 ;
3090+ Scalar half_height = size.height / 2 ;
3091+ std::vector<Rect> texture_coordinates = {
3092+ Rect::MakeLTRB (0 , 0 , half_width, half_height),
3093+ Rect::MakeLTRB (half_width, 0 , size.width , half_height),
3094+ Rect::MakeLTRB (0 , half_height, half_width, size.height ),
3095+ Rect::MakeLTRB (half_width, half_height, size.width , size.height )};
3096+ // Position quadrants adjacent to eachother.
3097+ std::vector<Matrix> transforms = {
3098+ Matrix::MakeTranslation ({0 , 0 , 0 }),
3099+ Matrix::MakeTranslation ({half_width, 0 , 0 }),
3100+ Matrix::MakeTranslation ({0 , half_height, 0 }),
3101+ Matrix::MakeTranslation ({half_width, half_height, 0 })};
3102+ std::vector<Color> colors = {Color::Red (), Color::Green (), Color::Blue (),
3103+ Color::Yellow ()};
3104+
3105+ Canvas canvas;
3106+ canvas.DrawAtlas (atlas, transforms, texture_coordinates, colors,
3107+ BlendMode::kPlus , {}, std::nullopt , {});
3108+
3109+ ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
3110+ }
3111+
30763112} // namespace testing
30773113} // namespace impeller
30783114
0 commit comments