This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch libavif-loader
in repository legacy-imlib2.

View the commit online.

commit 0c97138646c0bc15e2b0b03b74ba90bba4e96d80
Author: NRK <n...@disroot.org>
AuthorDate: Wed Feb 26 07:08:59 2025 +0000

    fix !load_data case
---
 src/modules/loaders/loader_avif.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/modules/loaders/loader_avif.c b/src/modules/loaders/loader_avif.c
index 7ebb03a..3ca5ef0 100644
--- a/src/modules/loaders/loader_avif.c
+++ b/src/modules/loaders/loader_avif.c
@@ -11,8 +11,8 @@ static int
 _load(ImlibImage *im, int load_data)
 {
     avifDecoder      *dec;
-    /* avifResult        res; */
     avifRGBImage      rgb;
+    avifImageTiming   timing;
     int               rc;
     int               frame, fcount;
     ImlibImageFrame  *pf;
@@ -44,15 +44,23 @@ _load(ImlibImage *im, int load_data)
         pf->loop_count = 0; // TODO?
         if (pf->frame_count > 1)
             pf->frame_flags |= FF_IMAGE_ANIMATED;
+        pf->frame_flags |= FF_FRAME_DISPOSE_CLEAR; // TODO??
         // TODO?
         pf->canvas_w = dec->image->width;
         pf->canvas_h = dec->image->height;
+
+        if (avifDecoderNthImageTiming(dec, frame - 1, &timing) != AVIF_RESULT_OK)
+            QUIT_WITH_RC(LOAD_BADIMAGE);
+        pf->frame_delay = (int)(timing.duration * 1000);
     }
     else
     {
         frame = 1;
     }
 
+    if (!load_data)
+        QUIT_WITH_RC(LOAD_SUCCESS);
+
     if (avifDecoderNthImage(dec, frame - 1) != AVIF_RESULT_OK)
         QUIT_WITH_RC(LOAD_BADIMAGE);
 
@@ -65,13 +73,8 @@ _load(ImlibImage *im, int load_data)
     {
         /* pf->frame_x = 0; */
         /* pf->frame_y = 0; */
-        pf->frame_delay = (int)(dec->imageTiming.duration * 1000);
-        pf->frame_flags |= FF_FRAME_DISPOSE_CLEAR; // TODO??
     }
 
-    if (!load_data)
-        QUIT_WITH_RC(LOAD_SUCCESS);
-
     if (!__imlib_AllocateData(im))
         QUIT_WITH_RC(LOAD_OOM);
 

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

Reply via email to