aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/shr.el59
1 files changed, 28 insertions, 31 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 3ab5116597b..3ff0c247780 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1101,39 +1101,36 @@ WIDTH and HEIGHT are the sizes given in the HTML data, if any.
1101The size of the displayed image will not exceed 1101The size of the displayed image will not exceed
1102MAX-WIDTH/MAX-HEIGHT. If not given, use the current window 1102MAX-WIDTH/MAX-HEIGHT. If not given, use the current window
1103width/height instead." 1103width/height instead."
1104 (if (or (not (fboundp 'imagemagick-types)) 1104 (let* ((edges (window-inside-pixel-edges
1105 (not (get-buffer-window (current-buffer)))) 1105 (get-buffer-window (current-buffer))))
1106 (create-image data nil t :ascent 100) 1106 (max-width (truncate (* shr-max-image-proportion
1107 (let* ((edges (window-inside-pixel-edges 1107 (or max-width
1108 (get-buffer-window (current-buffer)))) 1108 (- (nth 2 edges) (nth 0 edges))))))
1109 (max-width (truncate (* shr-max-image-proportion 1109 (max-height (truncate (* shr-max-image-proportion
1110 (or max-width 1110 (or max-height
1111 (- (nth 2 edges) (nth 0 edges)))))) 1111 (- (nth 3 edges) (nth 1 edges))))))
1112 (max-height (truncate (* shr-max-image-proportion 1112 (scaling (image-compute-scaling-factor image-scaling-factor)))
1113 (or max-height 1113 (when (or (and width
1114 (- (nth 3 edges) (nth 1 edges)))))) 1114 (> width max-width))
1115 (scaling (image-compute-scaling-factor image-scaling-factor))) 1115 (and height
1116 (when (or (and width 1116 (> height max-height)))
1117 (> width max-width)) 1117 (setq width nil
1118 (and height 1118 height nil))
1119 (> height max-height))) 1119 (if (and width height
1120 (setq width nil 1120 (< (* width scaling) max-width)
1121 height nil)) 1121 (< (* height scaling) max-height))
1122 (if (and width height
1123 (< (* width scaling) max-width)
1124 (< (* height scaling) max-height))
1125 (create-image
1126 data 'imagemagick t
1127 :ascent 100
1128 :width width
1129 :height height
1130 :format content-type)
1131 (create-image 1122 (create-image
1132 data 'imagemagick t 1123 data nil t
1133 :ascent 100 1124 :ascent 100
1134 :max-width max-width 1125 :width width
1135 :max-height max-height 1126 :height height
1136 :format content-type))))) 1127 :format content-type)
1128 (create-image
1129 data nil t
1130 :ascent 100
1131 :max-width max-width
1132 :max-height max-height
1133 :format content-type))))
1137 1134
1138;; url-cache-extract autoloads url-cache. 1135;; url-cache-extract autoloads url-cache.
1139(declare-function url-cache-create-filename "url-cache" (url)) 1136(declare-function url-cache-create-filename "url-cache" (url))