summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-05-15 02:53:56 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-05-15 02:53:56 +0200
commite3fbe04cbcfecbf3c8b6c8686a2612dbd4b6386a (patch)
tree8957b25efaa278fbc56654d1750427655b706d2b /lisp/net
parent4b2c9f638affcbbed171e3381ee523135ee3c31a (diff)
downloademacs-e3fbe04cbcfecbf3c8b6c8686a2612dbd4b6386a.tar.gz
Make image scaling work without imagemagick support in eww
* lisp/net/shr.el (shr-rescale-image): Emacs has native image scaling now, so images can be rescaled without imagemagick support.
Diffstat (limited to 'lisp/net')
-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.
The size of the displayed image will not exceed
MAX-WIDTH/MAX-HEIGHT. If not given, use the current window
width/height instead."
- (if (or (not (fboundp 'imagemagick-types))
- (not (get-buffer-window (current-buffer))))
- (create-image data nil t :ascent 100)
- (let* ((edges (window-inside-pixel-edges
- (get-buffer-window (current-buffer))))
- (max-width (truncate (* shr-max-image-proportion
- (or max-width
- (- (nth 2 edges) (nth 0 edges))))))
- (max-height (truncate (* shr-max-image-proportion
- (or max-height
- (- (nth 3 edges) (nth 1 edges))))))
- (scaling (image-compute-scaling-factor image-scaling-factor)))
- (when (or (and width
- (> width max-width))
- (and height
- (> height max-height)))
- (setq width nil
- height nil))
- (if (and width height
- (< (* width scaling) max-width)
- (< (* height scaling) max-height))
- (create-image
- data 'imagemagick t
- :ascent 100
- :width width
- :height height
- :format content-type)
+ (let* ((edges (window-inside-pixel-edges
+ (get-buffer-window (current-buffer))))
+ (max-width (truncate (* shr-max-image-proportion
+ (or max-width
+ (- (nth 2 edges) (nth 0 edges))))))
+ (max-height (truncate (* shr-max-image-proportion
+ (or max-height
+ (- (nth 3 edges) (nth 1 edges))))))
+ (scaling (image-compute-scaling-factor image-scaling-factor)))
+ (when (or (and width
+ (> width max-width))
+ (and height
+ (> height max-height)))
+ (setq width nil
+ height nil))
+ (if (and width height
+ (< (* width scaling) max-width)
+ (< (* height scaling) max-height))
(create-image
- data 'imagemagick t
+ data nil t
:ascent 100
- :max-width max-width
- :max-height max-height
- :format content-type)))))
+ :width width
+ :height height
+ :format content-type)
+ (create-image
+ data nil t
+ :ascent 100
+ :max-width max-width
+ :max-height max-height
+ :format content-type))))
;; url-cache-extract autoloads url-cache.
(declare-function url-cache-create-filename "url-cache" (url))