1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:27:35 +00:00

LibGfx/TinyVG: Fix decoding green channel of graphics RGB565 colors

The division was missed here, so this would produce overly bright greens
(or overflow).
This commit is contained in:
MacDue 2024-03-12 19:31:17 +00:00 committed by Sam Atkins
parent 633f0067c1
commit 4c15c87d0c
3 changed files with 12 additions and 1 deletions

View file

@ -1204,6 +1204,17 @@ TEST_CASE(test_tvg_malformed)
}
}
TEST_CASE(test_tvg_rgb565)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("tvg/green-rgb565.tvg"sv)));
EXPECT(Gfx::TinyVGImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::TinyVGImageDecoderPlugin::create(file->bytes()));
auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 100, 100 }));
// Should be a solid dark green:
EXPECT_EQ(frame.image->get_pixel(50, 50), Gfx::Color(0, 130, 0));
}
TEST_CASE(test_jxl_modular_simple_tree_upsample2_10bits)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("jxl/modular_simple_tree_upsample2_10bits_rct.jxl"sv)));

Binary file not shown.