mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibGfx/WebP: Do not add alpha channel for animated images without alpha
In practice, it looks like e.g. the animaged webp file on https://mathiasbynens.be/demo/animated-webp has the header flag set, because 2 of the frames have alpha, but they're composited on top of the final bitmap, but the final bitmap isn't transparent there. So that image still gets a useless alpha channel. Oh well.
This commit is contained in:
parent
f18ae19122
commit
9e8b507fad
1 changed files with 2 additions and 1 deletions
|
@ -583,7 +583,8 @@ static ErrorOr<ImageFrameDescriptor> decode_webp_animation_frame(WebPLoadingCont
|
|||
dbgln_if(WEBP_DEBUG, "start_frame {} context.current_frame {}", start_frame, context.current_frame);
|
||||
if (context.state < WebPLoadingContext::State::BitmapDecoded) {
|
||||
start_frame = 0;
|
||||
context.bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, { context.vp8x_header.width, context.vp8x_header.height }));
|
||||
auto format = context.vp8x_header.has_alpha ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888;
|
||||
context.bitmap = TRY(Bitmap::create(format, { context.vp8x_header.width, context.vp8x_header.height }));
|
||||
context.bitmap->fill(clear_color);
|
||||
} else if (frame_index < context.current_frame) {
|
||||
start_frame = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue