Function: image--scale-within-limits-p
image--scale-within-limits-p is a byte-compiled function defined in
image-mode.el.gz.
Signature
(image--scale-within-limits-p IMAGE)
Documentation
Return t if fit-window will scale image within the customized limits.
The limits are given by the user option
image-auto-resize-max-scale-percent.
Source Code
;; Defined in /usr/src/emacs/lisp/image-mode.el.gz
(defun image--scale-within-limits-p (image)
"Return t if `fit-window' will scale image within the customized limits.
The limits are given by the user option
`image-auto-resize-max-scale-percent'."
(or (not image-auto-resize-max-scale-percent)
(let ((scale (/ image-auto-resize-max-scale-percent 100))
(mw (plist-get (cdr image) :max-width))
(mh (plist-get (cdr image) :max-height))
;; Note: `image-size' looks up and thus caches the
;; untransformed image. There's no easy way to
;; prevent that.
(size (image-size image t)))
(or (<= mw (* (car size) scale))
(<= mh (* (cdr size) scale))))))