Skip to content

Commit

Permalink
LibGfx/WebPLoader: Use transparent black as animation background color
Browse files Browse the repository at this point in the history
This matches libwebp (see ZeroFillCanvas() call in
libwebp/src/demux/anim_decode.c:355 and ZeroFillFrameRect() call
in line 435, but in WebPAnimDecoderGetNext()) and makes files
written e.g. by asesprite look correct -- even though the old
behavior is also spec-compliant and arguably makes more sense.
Now nothing looks at the background color stored in the file.

See PR for an example image where it makes a visible difference.
  • Loading branch information
nico authored and doctortheemh committed Jul 15, 2024
1 parent 906fa04 commit 07f8321
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Tests/LibGfx/TestImageDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ TEST_CASE(test_webp_extended_lossless_animated)
EXPECT_EQ(frame.image->get_pixel(500, 700), Gfx::Color::Yellow);

// This one isn't the same in all frames.
EXPECT_EQ(frame.image->get_pixel(500, 0), (frame_index == 2 || frame_index == 6) ? Gfx::Color::Black : Gfx::Color(255, 255, 255, 0));
EXPECT_EQ(frame.image->get_pixel(500, 0), (frame_index == 2 || frame_index == 6) ? Gfx::Color::Black : Gfx::Color(0, 0, 0, 0));
}
}

Expand Down

0 comments on commit 07f8321

Please sign in to comment.