emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102695: Revert "gnus-util: rewrite g


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102695: Revert "gnus-util: rewrite gnus-rescale-image".
Date: Mon, 20 Dec 2010 22:12:30 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102695
author: Julien Danjou <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Mon 2010-12-20 22:12:30 +0000
message:
  Revert "gnus-util: rewrite gnus-rescale-image".
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/gnus-util.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-12-17 22:45:16 +0000
+++ b/lisp/gnus/ChangeLog       2010-12-20 22:12:30 +0000
@@ -14,11 +14,6 @@
 
        * nnimap.el (nnimap-retrieve-headers): Remove CRLF from the headers.
 
-2010-12-17  Julien Danjou  <address@hidden>
-
-       * gnus-util.el (gnus-rescale-image): Allow to resize images even if
-       they are from file. Can also scale up.
-
 2010-12-17  Andrew Cohen  <address@hidden>
 
        * gnus-sum.el (gnus-summary-refer-thread): Simplify code. Restore

=== modified file 'lisp/gnus/gnus-util.el'
--- a/lisp/gnus/gnus-util.el    2010-12-17 22:45:16 +0000
+++ b/lisp/gnus/gnus-util.el    2010-12-20 22:12:30 +0000
@@ -1983,16 +1983,21 @@
   "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."


reply via email to

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