summaryrefslogtreecommitdiff
path: root/lisp/image.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2013-02-19 23:57:33 -0800
committerGlenn Morris <rgm@gnu.org>2013-02-19 23:57:33 -0800
commitdc50451531dfc30dadec09cb65249aa228d8b760 (patch)
tree5c4afb5add9617066191ab476b0d1b0a1c0caccd /lisp/image.el
parent618185046817f98751c558d19bc1396b1eba612b (diff)
downloademacs-dc50451531dfc30dadec09cb65249aa228d8b760.tar.gz
Rework recent image-multi-frame stuff a little
* image.el (image-current-frame): Change from variable to function. (image-show-frame): Rename from image-nth-frame. Update callers. * image-mode.el (image-multi-frame): New variable. (image-mode-map, image-mode, image-goto-frame): Use image-multi-frame rather than image-current-frame. (image-mode, image-goto-frame): Use image-current-frame as function rather than as variable.
Diffstat (limited to 'lisp/image.el')
-rw-r--r--lisp/image.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/lisp/image.el b/lisp/image.el
index b91d136443d..ec7b41bf126 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -660,10 +660,11 @@ number, play until that number of seconds has elapsed."
(defconst image-minimum-frame-delay 0.01
"Minimum interval in seconds between frames of an animated image.")
-(defvar-local image-current-frame nil
- "The frame index of the current animated image.")
+(defun image-current-frame (image)
+ "The current frame number of IMAGE, indexed from 0."
+ (or (plist-get (cdr image) :index) 0))
-(defun image-nth-frame (image n &optional nocheck)
+(defun image-show-frame (image n &optional nocheck)
"Show frame N of IMAGE.
Frames are indexed from 0. Optional argument NOCHECK non-nil means
do not check N is within the range of frames present in the image."
@@ -671,7 +672,6 @@ do not check N is within the range of frames present in the image."
(if (< n 0) (setq n 0)
(setq n (min n (1- (car (image-multi-frame-p image)))))))
(plist-put (cdr image) :index n)
- (setq image-current-frame n)
(force-window-update))
;; FIXME? The delay may not be the same for different sub-images,
@@ -688,7 +688,7 @@ LIMIT determines when to stop. If t, loop forever. If nil, stop
after displaying the last animation frame. Otherwise, stop
after LIMIT seconds have elapsed.
The minimum delay between successive frames is `image-minimum-frame-delay'."
- (image-nth-frame image n t)
+ (image-show-frame image n t)
(setq n (1+ n))
(let* ((time (float-time))
(animation (image-multi-frame-p image))