all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 6258@debbugs.gnu.org
Subject: bug#6258: create-animated-image hangs
Date: Mon, 24 May 2010 19:03:21 +0300	[thread overview]
Message-ID: <87d3wmq8v2.fsf@mail.jurta.org> (raw)

When the delay between images in an animated GIF file is 0,
then calls for `run-with-timer' without delay hangs up.
Replacing it with `run-with-idle-timer' doesn't help.
An example of the animated GIF that hangs up is
http://en.wikipedia.org/wiki/File:Animated_glider_emblem.gif

This patch makes a short delay (0.1 sec) in this case.
Visually its speed looks the same as the speed of changing
images in Firefox when an animated GIF has no delay.

=== modified file 'lisp/image.el'
--- lisp/image.el	2010-04-02 23:28:46 +0000
+++ lisp/image.el	2010-05-24 16:01:45 +0000
@@ -684,10 +684,13 @@ (defun image-animated-p (image)
     (let* ((metadata (image-metadata image))
 	   (images (plist-get metadata 'count))
 	   (extdata (plist-get metadata 'extension-data))
-	   (anim (plist-get extdata #xF9)))
-      (and (integerp images) (> images 1)
-	   (stringp anim) (>= (length anim) 4)
-	   (cons images (+ (aref anim 1) (* (aref anim 2) 256))))))))
+	   (anim (plist-get extdata #xF9))
+	   (tmo (and (integerp images) (> images 1)
+		     (stringp anim) (>= (length anim) 4)
+		     (+ (aref anim 1) (* (aref anim 2) 256)))))
+      (when tmo
+	(if (eq tmo 0) (setq tmo 10))
+	(cons images tmo))))))
 
 \f
 (provide 'image)

-- 
Juri Linkov
http://www.jurta.org/emacs/





             reply	other threads:[~2010-05-24 16:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 16:03 Juri Linkov [this message]
2010-05-25 15:57 ` bug#6258: create-animated-image hangs Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3wmq8v2.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=6258@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.