mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
LibGfx: Set png interlace handling on interlaced images
This commit is contained in:
parent
9c63785d0f
commit
1881a8df4b
Notes:
github-actions[bot]
2024-12-04 20:30:07 +00:00
Author: https://github.com/Psychpsyo
Commit: 1881a8df4b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2762
Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 5 additions and 1 deletions
|
@ -115,7 +115,8 @@ ErrorOr<void> PNGImageDecoderPlugin::initialize()
|
|||
u32 height = 0;
|
||||
int bit_depth = 0;
|
||||
int color_type = 0;
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr);
|
||||
int interlace_type = 0;
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, &interlace_type, nullptr, nullptr);
|
||||
m_context->size = { static_cast<int>(width), static_cast<int>(height) };
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
|
@ -133,6 +134,9 @@ ErrorOr<void> PNGImageDecoderPlugin::initialize()
|
|||
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png_ptr);
|
||||
|
||||
if (interlace_type != PNG_INTERLACE_NONE)
|
||||
png_set_interlace_handling(png_ptr);
|
||||
|
||||
png_set_filler(png_ptr, 0xFF, PNG_FILLER_AFTER);
|
||||
png_set_bgr(png_ptr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue