]> code.delx.au - gnu-emacs/commitdiff
:max-width/height fixes for shr after the scaling changes
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 14 May 2016 20:57:36 +0000 (22:57 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 14 May 2016 20:57:53 +0000 (22:57 +0200)
* lisp/net/shr.el (shr-rescale-image): Ensure that we respect
max-width and max-height even after the scaling changes done
earlier this year.

lisp/net/shr.el

index d91b00ca77da821cb502664d1e6590e3d25abc53..9d42fde0756fe7398f1f54253292b7bfb6df3e7e 100644 (file)
@@ -1016,14 +1016,17 @@ WIDTH and HEIGHT are the sizes given in the HTML data, if any."
            (max-width (truncate (* shr-max-image-proportion
                                    (- (nth 2 edges) (nth 0 edges)))))
            (max-height (truncate (* shr-max-image-proportion
-                                    (- (nth 3 edges) (nth 1 edges))))))
+                                    (- (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)
+      (if (and width height
+               (< (* width scaling) max-width)
+               (< (* height scaling) max-height))
           (create-image
            data 'imagemagick t
            :ascent 100