commit 19e95044a5654235c61544be1c6a2f98a55f1721 parent ce0f96a2612ba8b7b0c078c306820147924eacdf Author: Tomas Hlavaty <tom@logand.com> Date: Sun, 7 Jun 2020 22:42:34 +0200 use integers Diffstat:
M | emacs-framebuffer.el | | | 8 | +++++--- |
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/emacs-framebuffer.el b/emacs-framebuffer.el @@ -182,9 +182,11 @@ (destructuring-bind (w &rest h) (framebuffer-image-size file) (destructuring-bind (fw &rest fh) (framebuffer-size) (let* ((scale (min (/ fw 1.0 w) (/ fh 1.0 h))) - (ww (* scale w)) - (hh (* scale h))) - (framebuffer-draw (/ (- fw ww) 2) (/ (- fh hh) 2) ww hh file))))) + (ww (floor (* scale w))) + (hh (floor (* scale h))) + (xx (floor (- fw ww) 2)) + (yy (floor (- fh hh) 2))) + (framebuffer-draw xx yy ww hh file))))) (defun framebuffer-image-buffer () (interactive)