1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 13:37:10 +09:00
Commit graph

10 commits

Author SHA1 Message Date
aplefull
7da2339c89 LibGfx: Properly skip IDAT chunks without fcTL in APNG files
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.
2025-05-09 21:45:29 +02:00
aplefull
71a4e18bf8 LibGfx: Only include frames with fcTL chunks in the animation
Before this change, IDAT data was mistakenly always included in the
animation. Now we only include frames with explicit fcTL chunks.

As per the PNG spec (third edition):
"The static image may be included as the first frame of the animation
by the presence of a single fcTL chunk before IDAT. Otherwise, the
static image is not part of the animation."

We also fall back to the IDAT data when APNG has acTL but no fcTL
chunks. Test image is 062.png from fDAT-inherits-cICP.html from WPT.
2025-05-01 10:30:00 +02:00
Jelle Raaijmakers
c6644c92e7 LibGfx: Factor out PNG frame decoding logic
The logic for decoding APNGs and single-frame PNGs had some duplicated
code. No functional changes.
2025-03-22 17:49:38 +01:00
Lucas CHOLLET
a144481e6c LibGfx/PNG: Read the cICP chunk 2025-02-12 12:03:30 -05:00
Glenn Skrzypczak
8575bddfe6 LibWeb/Canvas: Support globalCompositionOperation
Canvas now supports compositing and various blending modes via the
`globalCompositeOperation` attribute.
2025-02-05 11:26:58 +00:00
Andreas Kling
9164c9784d LibGfx: Treat PNG files with invalid frame data as transparent
If we have a valid PNG header with geometry info etc, we should still
display it as *something*, even if the image data itself is missing or
corrupted.

This matches the behavior of other browsers, and is something that
Cloudflare Turnstile checks for.

To achieve this, we split the PNG decoder's initialization into two
steps: "everything except reading frame data" and "reading frame data".
If the latter step fails, we yield a transparent bitmap with the
geometry from the PNG's IHDR chunk.
2024-12-19 16:49:28 +01:00
Lucien Fiorini
a6ef6550f3 LibWeb+LibGfx: Implement Canvas2D filters 2024-12-18 18:54:20 +01:00
rmg-x
e4fb25bf63 LibGfx: Redirect PNG errors and warnings to our own logging functions
Before, libpng would use its own internal logging mechanism to print
non-fatal errors and warnings to stdout/stderr. This made it confusing
when trying to search the Ladybird codebase for those messages as they
didn't exist.

This commit uses `png_set_error_fn` from libpng to redirect those
messages to our own custom logging functions instead.
2024-12-10 11:58:58 -07:00
Psychpsyo
1881a8df4b LibGfx: Set png interlace handling on interlaced images 2024-12-04 20:29:15 +00:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp (Browse further)