emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GDI+ take 3


From: Juan José García-Ripoll
Subject: Re: GDI+ take 3
Date: Sat, 18 Apr 2020 10:41:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt)

Eli Zaretskii <address@hidden> writes:
>> From: Juan José García-Ripoll <address@hidden>:
>> Can you please send me the offending TIFF file? I tested the code with
>> multipage TIFF's and multipage GIF's and it worked well. It did not get
>> the delays right, but was never crashing on a Windows 10 computer.
>
> It could be that my changes caused this.  Apologies if that's the
> reason.

No, it is not your fault. You actually almost fixed my delay decoding
routine. The problem is that the TIFF file has no delay tag. This is
seen if you deactivate the native API and use libtiff. I have fixed this
using the attached patch. I use the following code to test it.

(setq w32-use-native-image-API t)
(defvar test-image nil)
(setq debug-on-error t)
(setq test-image (create-image "image-test.tiff"))
(message "Delay: %S" (image-multi-frame-p test-image))
(insert-image test-image)
(image-animate test-image)

-- 
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es
diff --git a/src/w32image.c b/src/w32image.c
index 0a2a55d..24970ae 100644
--- a/src/w32image.c
+++ b/src/w32image.c
@@ -246,10 +246,15 @@ w32_frame_delay (GpBitmap *pBitmap, int frame)
   UINT size;
   PropertyItem *propertyItem;
   double delay = 0.0;
+  GpStatus status = Ok;
 
   /* Assume that the image has a property item of type PropertyItemEquipMake.
      Get the size of that property item.  */
-  GdipGetPropertyItemSize (pBitmap, PropertyTagFrameDelay, &size);
+  status = GdipGetPropertyItemSize (pBitmap, PropertyTagFrameDelay, &size);
+  if (status != Ok) {
+    /* Property not found.  */
+    return -1;
+  }
 
   /* Allocate a buffer to receive the property item.  */
   propertyItem = malloc (size);
@@ -372,7 +377,7 @@ w32_load_image (struct frame *f, struct image *img,
         {
           if (nframes > 1)
             metadata = Fcons (Qcount, Fcons (make_fixnum (nframes), metadata));
-          if (delay)
+          if (delay >= 0)
             metadata = Fcons (Qdelay, Fcons (make_float (delay), metadata));
         }
       else if (status == Win32Error) /* FIXME! */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]