mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibGfx: Properly skip IDAT chunks without fcTL in APNG files
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
In the previous fix, we were still drawing IDAT data to the reference frame even when no fcTL was present. This would cause rendering issues when subsequent frames use APNG_BLEND_OP_OVER blending mode, as they would composite over the incorrect reference frame. This commit adds a simple check to properly skip any frame without an fcTL chunk.
This commit is contained in:
parent
e5944a4d9e
commit
7da2339c89
Notes:
github-actions[bot]
2025-05-09 19:49:13 +00:00
Author: https://github.com/aplefull
Commit: 7da2339c89
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4660
Reviewed-by: https://github.com/gmta ✅
3 changed files with 21 additions and 4 deletions
|
@ -301,6 +301,9 @@ ErrorOr<size_t> PNGLoadingContext::read_frames(png_structp png_ptr, png_infop in
|
|||
|
||||
auto decoded_frame_bitmap = TRY(decode_frame({ width, height }));
|
||||
|
||||
if (!has_fcTL)
|
||||
continue;
|
||||
|
||||
RefPtr<Bitmap> prev_output_buffer;
|
||||
if (dispose_op == PNG_DISPOSE_OP_PREVIOUS) // Only actually clone if it's necessary
|
||||
prev_output_buffer = TRY(output_buffer->clone());
|
||||
|
@ -318,10 +321,8 @@ ErrorOr<size_t> PNGLoadingContext::read_frames(png_structp png_ptr, png_infop in
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (has_fcTL) {
|
||||
animation_frame_count++;
|
||||
frame_descriptors.append({ TRY(output_buffer->clone()), duration_ms() });
|
||||
}
|
||||
animation_frame_count++;
|
||||
frame_descriptors.append({ TRY(output_buffer->clone()), duration_ms() });
|
||||
|
||||
switch (dispose_op) {
|
||||
case PNG_DISPOSE_OP_NONE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue