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 e47d330a390d33877ddf04f118b99c04bdf9193a
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Mon Mar 3 08:28:49 2025 +0100

    GIF loader: Fix minor issue when loading transparent gifs
    
    Transparency would not be correct when explicitly loading frame 0
    (not a normal scenario).
---
 src/modules/loaders/loader_gif.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/modules/loaders/loader_gif.c b/src/modules/loaders/loader_gif.c
index 06ab13e..a3ad0a6 100644
--- a/src/modules/loaders/loader_gif.c
+++ b/src/modules/loaders/loader_gif.c
@@ -227,7 +227,7 @@ _load(ImlibImage *im, int load_data)
         }
         else if (rec == EXTENSION_RECORD_TYPE)
         {
-            int             ext_code, disp;
+            int             ext_code;
             GifByteType    *ext;
 
             ext = NULL;
@@ -237,20 +237,26 @@ _load(ImlibImage *im, int load_data)
                 DL(" EXTENSION_RECORD_TYPE(%d): ic=%d: ext_code=%02x: %02x %02x %02x %02x %02x\n",      //
                    rec, gif->ImageCount, ext_code,
                    ext[0], ext[1], ext[2], ext[3], ext[4]);
-                if (pf && ext_code == GRAPHICS_EXT_FUNC_CODE &&
+                if (ext_code == GRAPHICS_EXT_FUNC_CODE &&
                     gif->ImageCount == frame - 1)
                 {
+                    int             frame_delay, disp;
+
                     bits = ext[1];
-                    pf->frame_delay = 10 * (0x100 * ext[3] + ext[2]);
+                    frame_delay = 10 * (0x100 * ext[3] + ext[2]);
                     if (bits & 1)
                         transp = ext[4];
                     disp = (bits >> 2) & 0x7;
-                    if (disp == 2 || disp == 3)
-                        pf->frame_flags |= FF_FRAME_DISPOSE_CLEAR;
-                    pf->frame_flags |= FF_FRAME_BLEND;
                     D(" Frame %d: disp=%d ui=%d tr=%d, delay=%d transp = #%02x\n",      //
                       gif->ImageCount + 1, disp, (bits >> 1) & 1, bits & 1,
-                      pf->frame_delay, transp);
+                      frame_delay, transp);
+                    if (pf)
+                    {
+                        pf->frame_delay = frame_delay;
+                        if (disp == 2 || disp == 3)
+                            pf->frame_flags |= FF_FRAME_DISPOSE_CLEAR;
+                        pf->frame_flags |= FF_FRAME_BLEND;
+                    }
                 }
                 ext = NULL;
                 DGifGetExtensionNext(gif, &ext);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to