summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-util.el
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2010-12-20 22:12:30 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-12-20 22:12:30 +0000
commitc486dd9609b90cc9f731db8d459afc25d571e446 (patch)
treec6873d718ddaca8a0a66a7fc17198a0ad6577ffb /lisp/gnus/gnus-util.el
parentadc0b7934703173b0f351a44181a6317dcf59acf (diff)
downloademacs-c486dd9609b90cc9f731db8d459afc25d571e446.tar.gz
Revert "gnus-util: rewrite gnus-rescale-image".
Diffstat (limited to 'lisp/gnus/gnus-util.el')
-rw-r--r--lisp/gnus/gnus-util.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 50292f4ff76..fa4bf076a30 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1983,16 +1983,21 @@ empty directories from OLD-PATH."
"Rescale IMAGE to SIZE if possible.
SIZE is in format (WIDTH . HEIGHT). Return a new image.
Sizes are in pixels."
- (when (fboundp 'imagemagick-types)
+ (if (or (not (fboundp 'imagemagick-types))
+ (not (get-buffer-window (current-buffer))))
+ image
(let ((new-width (car size))
(new-height (cdr size)))
- (unless (= (cdr (image-size image t)) new-height)
- (setcdr image (plist-put (cdr image) :type 'imagemagick))
- (setcdr image (plist-put (cdr image) :height new-height)))
- (unless (= (car (image-size image t)) new-width)
- (setcdr image (plist-put (cdr image) :type 'imagemagick))
- (setcdr image (plist-put (cdr image) :width new-width)))))
- image)
+ (when (> (cdr (image-size image t)) new-height)
+ (setq image (or (create-image (plist-get (cdr image) :data) 'imagemagick t
+ :height new-height)
+ image)))
+ (when (> (car (image-size image t)) new-width)
+ (setq image (or
+ (create-image (plist-get (cdr image) :data) 'imagemagick t
+ :width new-width)
+ image)))
+ image)))
(defun gnus-list-memq-of-list (elements list)
"Return non-nil if any of the members of ELEMENTS are in LIST."