kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2_loaders.git/commit/?id=7699e6155a22c451c1d585f8e95f644a40e15f9c

commit 7699e6155a22c451c1d585f8e95f644a40e15f9c
Author: Kim Woelders <k...@woelders.dk>
Date:   Fri Nov 22 18:59:50 2019 +0100

    ANI loader: If .ani looks good we must try .ico loading chunks
---
 src/modules/loaders/loader_ani.c | 50 +++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/src/modules/loaders/loader_ani.c b/src/modules/loaders/loader_ani.c
index a4d794c..b6374f8 100644
--- a/src/modules/loaders/loader_ani.c
+++ b/src/modules/loaders/loader_ani.c
@@ -244,6 +244,7 @@ char
 load(ImlibImage * im, ImlibProgressFunction progress, char 
progress_granularity,
      char immediate_load)
 {
+   int                 rc;
    ImlibLoader        *loader;
    MsAni              *ani = NULL;
    MsChunk            *chunk;
@@ -252,46 +253,43 @@ load(ImlibImage * im, ImlibProgressFunction progress, 
char progress_granularity,
    if (!loader)
       return 0;
 
-   if (im->loader || immediate_load || progress)
-     {
-        if (!(ani = ani_init((im->real_file))))
-           return 0;
+   if (!(ani = ani_init((im->real_file))))
+      return 0;
 
-        ani_load(ani);
+   ani_load(ani);
 
-        for (chunk = ani->chunks; chunk; chunk = chunk->next)
+   rc = 0;
+
+   for (chunk = ani->chunks; chunk; chunk = chunk->next)
+     {
+        if (chunk->chunk_id == 0x6E6F6369)
           {
-             if (chunk->chunk_id == 0x6E6F6369)
-               {
-                  char               *file;
-                  char               *tmpfile;
+             char               *file;
+             char               *tmpfile;
 
-                  if (!(tmpfile = ani_save_ico(chunk)))
-                     return 0;
+             if (!(tmpfile = ani_save_ico(chunk)))
+                break;
 
-                  file = im->real_file;
-                  im->real_file = tmpfile;
-                  loader->load(im, progress, progress_granularity,
+             file = im->real_file;
+             im->real_file = tmpfile;
+             rc = loader->load(im, progress, progress_granularity,
                                immediate_load);
-                  im->real_file = file;
+             im->real_file = file;
 
-                  unlink(tmpfile);
-                  free(tmpfile);
-                  break;
-               }
+             unlink(tmpfile);
+             free(tmpfile);
+             break;
           }
-
-        ani_cleanup(ani);
      }
 
-   if (progress)
+   ani_cleanup(ani);
+
+   if (rc == 1 && progress)
      {
         progress(im, 100, 0, 0, im->w, im->h);
      }
 
-   return 1;
-
-   progress_granularity = 0;
+   return rc;
 }
 
 void

-- 


Reply via email to