This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit 272c737cc37ec899087e82d7b4e1f47490b7db70
Author: Kim Woelders <[email protected]>
AuthorDate: Sun Oct 9 07:23:50 2022 +0200
PNG loader: Improved handling of animated PNGs
Correct handling of initial image (IDAT vs fcTL order).
---
src/modules/loaders/loader_png.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/modules/loaders/loader_png.c b/src/modules/loaders/loader_png.c
index d8d109c..bbec8d2 100644
--- a/src/modules/loaders/loader_png.c
+++ b/src/modules/loaders/loader_png.c
@@ -302,7 +302,7 @@ _load(ImlibImage * im, int load_data)
const png_fctl_t *pfctl;
unsigned int len, val;
int w, h, frame;
- bool save_fdat;
+ bool save_fdat, seen_fctl;
png_chunk_t cbuf;
/* read header */
@@ -411,6 +411,7 @@ _load(ImlibImage * im, int load_data)
/* Now feed data into libpng to extract requested frame */
save_fdat = false;
+ seen_fctl = false;
/* At this point we start "progressive" PNG data processing */
fptr = (unsigned char *)im->fi->fdata;
@@ -486,8 +487,10 @@ _load(ImlibImage * im, int load_data)
/* Needed chunks should now be read */
/* Note - Just before starting to process data chunks libpng will
* call info_callback() */
- if (im->frame_num <= 1)
- break; /* Process actual IDAT chunk */
+ if (im->frame_count <= 0)
+ break; /* Regular PNG - Process actual IDAT chunk */
+ if (im->frame_num == 1 && seen_fctl)
+ break; /* APNG, First frame is IDAT */
/* Jump to the record after the frame's fcTL, will typically be
* the frame's first fdAT chunk */
fptr = (unsigned char *)ctx.pch_fctl;
@@ -508,13 +511,12 @@ _load(ImlibImage * im, int load_data)
D("\n");
if (save_fdat)
goto done; /* First fcTL after frame's fdAT's - done */
+ seen_fctl = true;
continue;
case PNG_TYPE_fdAT:
#define P (&chunk->fdat)
D("\n");
- if (im->frame_num <= 1)
- continue;
if (!save_fdat)
continue;
/* Process fake IDAT frame data */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.