emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117900: Preserve the aspect ratio when fitting to w


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] trunk r117900: Preserve the aspect ratio when fitting to width/height
Date: Thu, 18 Sep 2014 18:35:09 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117900
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Thu 2014-09-18 20:34:59 +0200
message:
  Preserve the aspect ratio when fitting to width/height
  
  * image-mode.el (image-toggle-display-image): If we have a
  `fit-width' or a `fit-height', don't limit the size of the image
  to the window size, because that doesn't preserve the aspect
  ratio.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/image-mode.el             
imagemode.el-20091113204419-o5vbwnq5f7feedwu-3391
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-17 09:17:27 +0000
+++ b/lisp/ChangeLog    2014-09-18 18:34:59 +0000
@@ -1,3 +1,10 @@
+2014-09-18  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * image-mode.el (image-toggle-display-image): If we have a
+       `fit-width' or a `fit-height', don't limit the size of the image
+       to the window size, because that doesn't preserve the aspect
+       ratio.
+
 2014-09-17  Reuben Thomas  <address@hidden>
 
        * progmodes/js.el: Add interpreter-mode-alist support for various

=== modified file 'lisp/image-mode.el'
--- a/lisp/image-mode.el        2014-08-12 14:16:45 +0000
+++ b/lisp/image-mode.el        2014-09-18 18:34:59 +0000
@@ -642,14 +642,19 @@
                           (string-make-unibyte
                            (buffer-substring-no-properties (point-min) 
(point-max)))
                         filename))
-        (edges (window-inside-pixel-edges
-                (get-buffer-window (current-buffer))))
+        ;; If we have a `fit-width' or a `fit-height', don't limit
+        ;; the size of the image to the window size.
+        (edges (and (null image-transform-resize)
+                    (window-inside-pixel-edges
+                     (get-buffer-window (current-buffer)))))
         (type (if (fboundp 'imagemagick-types)
                   'imagemagick
                 (image-type file-or-data nil data-p)))
-        (image (create-image file-or-data type data-p
-                             :max-width (- (nth 2 edges) (nth 0 edges))
-                             :max-height (- (nth 3 edges) (nth 1 edges))))
+        (image (if (not edges)
+                   (create-image file-or-data type data-p)
+                 (create-image file-or-data type data-p
+                               :max-width (- (nth 2 edges) (nth 0 edges))
+                               :max-height (- (nth 3 edges) (nth 1 edges)))))
         (inhibit-read-only t)
         (buffer-undo-list t)
         (modified (buffer-modified-p))


reply via email to

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