mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-29 08:11:13 +00:00
LibGfx: Enhance APNG format support
Improve handling of APNG chunks by avoiding premature termination when encountering non-fcTL chunks. With this patch, the browser now passes additional APNG-related tests in the "png/" Web Platform Tests (WPT) suite.
This commit is contained in:
parent
18fc23b3d6
commit
2d6069650a
Notes:
github-actions[bot]
2024-08-19 18:05:20 +00:00
Author: https://github.com/khaledev 🔰 Commit: https://github.com/LadybirdBrowser/ladybird/commit/2d6069650a6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1120
|
@ -244,15 +244,16 @@ ErrorOr<size_t> PNGLoadingContext::read_frames(png_structp png_ptr, png_infop in
|
|||
u32 y = 0;
|
||||
u16 delay_num = 0;
|
||||
u16 delay_den = 0;
|
||||
u8 dispose_op = 0;
|
||||
u8 blend_op = 0;
|
||||
u8 dispose_op = PNG_DISPOSE_OP_NONE;
|
||||
u8 blend_op = PNG_BLEND_OP_SOURCE;
|
||||
|
||||
if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_fcTL)) {
|
||||
return Error::from_string_literal("Missing fcTL chunk in APNG frame");
|
||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_fcTL)) {
|
||||
png_get_next_frame_fcTL(png_ptr, info_ptr, &width, &height, &x, &y, &delay_num, &delay_den, &dispose_op, &blend_op);
|
||||
} else {
|
||||
width = png_get_image_width(png_ptr, info_ptr);
|
||||
height = png_get_image_height(png_ptr, info_ptr);
|
||||
}
|
||||
|
||||
png_get_next_frame_fcTL(png_ptr, info_ptr, &width, &height, &x, &y, &delay_num, &delay_den, &dispose_op, &blend_op);
|
||||
|
||||
decoded_frame_bitmap = TRY(Bitmap::create(BitmapFormat::BGRA8888, AlphaType::Unpremultiplied, IntSize { static_cast<int>(width), static_cast<int>(height) }));
|
||||
|
||||
row_pointers.resize(height);
|
||||
|
|
Loading…
Reference in a new issue