From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juan =?utf-8?Q?Jos=C3=A9_Garc=C3=ADa-Ripoll?= Newsgroups: gmane.emacs.devel Subject: Re: GDI+ take 3 Date: Sat, 18 Apr 2020 10:41:42 +0200 Message-ID: <86mu79uqwp.fsf@csic.es> References: <86h7xzc5ai.fsf@csic.es> <83y2qwg673.fsf@gnu.org> <83v9m0g4yw.fsf@gnu.org> <83sgh4g3af.fsf@gnu.org> <83k12gfzxc.fsf@gnu.org> <83eesofyac.fsf@gnu.org> <83d088fwgt.fsf@gnu.org> <835ze0fqk2.fsf@gnu.org> <83sgh3eogs.fsf@gnu.org> <83o8rqd2jt.fsf@gnu.org> <86sgh2wozp.fsf@csic.es> <83ftd2cuc4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="122486"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) To: emacs-devel@gnu.org Cancel-Lock: sha1:MXT95UeAeSjuf3Gawk4FCMpDlqo= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 18 10:42:50 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPj3q-000Vkz-PY for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Apr 2020 10:42:50 +0200 Original-Received: from localhost ([::1]:55986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPj3p-0004gC-SX for ged-emacs-devel@m.gmane-mx.org; Sat, 18 Apr 2020 04:42:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47487) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPj2t-00048i-VK for emacs-devel@gnu.org; Sat, 18 Apr 2020 04:41:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPj2s-00038Q-MP for emacs-devel@gnu.org; Sat, 18 Apr 2020 04:41:51 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:56524) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jPj2s-0002za-Fl for emacs-devel@gnu.org; Sat, 18 Apr 2020 04:41:50 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jPj2q-000Ud8-FO for emacs-devel@gnu.org; Sat, 18 Apr 2020 10:41:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 159.69.161.202 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:247216 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Eli Zaretskii writes: >> From: Juan José García-Ripoll : >> 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=w32image.diff 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! */ --=-=-=--