LibGfx: Fix AVIF alpha type to be unpremultiplied
libavif outputs straight (unpremultiplied) alpha by default, but the AVIF loader was creating bitmaps without specifying an alpha type, which defaults to premultiplied. This mismatch caused semi-transparent pixels to render incorrectly. Pass AlphaType::Unpremultiplied explicitly, matching what the PNG, WebP, and BMP decoders already do.
This commit is contained in:
parent
ed6a5f25a0
commit
815f5e7d79
1 changed files with 1 additions and 1 deletions
|
|
@ -105,7 +105,7 @@ static ErrorOr<void> decode_avif_image(AVIFLoadingContext& context)
|
|||
avifRGBImage rgb;
|
||||
while (avifDecoderNextImage(context.decoder) == AVIF_RESULT_OK) {
|
||||
auto bitmap_format = context.has_alpha ? BitmapFormat::BGRA8888 : BitmapFormat::BGRx8888;
|
||||
auto bitmap = TRY(Bitmap::create(bitmap_format, context.size.value()));
|
||||
auto bitmap = TRY(Bitmap::create(bitmap_format, AlphaType::Unpremultiplied, context.size.value()));
|
||||
|
||||
avifRGBImageSetDefaults(&rgb, context.decoder->image);
|
||||
rgb.pixels = bitmap->scanline_u8(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue