From 7102e6d0a782c2bc4e74ced93daa27aa0d821bb8 Mon Sep 17 00:00:00 2001 From: Wolfgang Jenkner Date: Mon, 14 May 2012 01:15:59 -0400 Subject: [PATCH] * lisp/image-mode.el: Fix scaling. (image-transform-resize): Doc fix. (image-transform-properties): Default scale is 1 and height should be an integer. Fixes: debbugs:11399 --- lisp/ChangeLog | 7 +++++++ lisp/image-mode.el | 41 ++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 03b9a3ba15b..d0811170b4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-05-14 Wolfgang Jenkner + + * image-mode.el: Fix scaling (bug#11399). + (image-transform-resize): Doc fix. + (image-transform-properties): Default scale is 1 and height should + be an integer. + 2012-05-13 Johan Bockgård * emacs-lisp/smie.el (smie-next-sexp): Use accessor `op-forw' rather diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 900cd725b92..80321d6c94d 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -608,23 +608,23 @@ Otherwise it plays once, then stops." ;; Not yet implemented. -;;; (defvar image-transform-minor-mode-map -;;; (let ((map (make-sparse-keymap))) -;;; ;; (define-key map [(control ?+)] 'image-scale-in) -;;; ;; (define-key map [(control ?-)] 'image-scale-out) -;;; ;; (define-key map [(control ?=)] 'image-scale-none) -;;; ;; (define-key map "c f h" 'image-scale-fit-height) -;;; ;; (define-key map "c ]" 'image-rotate-right) -;;; map) -;;; "Minor mode keymap `image-transform-mode'.") -;;; -;;; (define-minor-mode image-transform-mode -;;; "Minor mode for scaling and rotating images. -;;; With a prefix argument ARG, enable the mode if ARG is positive, -;;; and disable it otherwise. If called from Lisp, enable the mode -;;; if ARG is omitted or nil. This minor mode requires Emacs to have -;;; been compiled with ImageMagick support." -;;; nil "image-transform" image-transform-minor-mode-map) +;; (defvar image-transform-minor-mode-map +;; (let ((map (make-sparse-keymap))) +;; ;; (define-key map [(control ?+)] 'image-scale-in) +;; ;; (define-key map [(control ?-)] 'image-scale-out) +;; ;; (define-key map [(control ?=)] 'image-scale-none) +;; ;; (define-key map "c f h" 'image-scale-fit-height) +;; ;; (define-key map "c ]" 'image-rotate-right) +;; map) +;; "Minor mode keymap `image-transform-mode'.") +;; +;; (define-minor-mode image-transform-mode +;; "Minor mode for scaling and rotating images. +;; With a prefix argument ARG, enable the mode if ARG is positive, +;; and disable it otherwise. If called from Lisp, enable the mode +;; if ARG is omitted or nil. This minor mode requires Emacs to have +;; been compiled with ImageMagick support." +;; nil "image-transform" image-transform-minor-mode-map) ;; FIXME this doesn't seem mature yet. Document in manual when it is. @@ -634,7 +634,7 @@ Its value should be one of the following: - nil, meaning no resizing. - `fit-height', meaning to fit the image to the window height. - `fit-width', meaning to fit the image to the window width. - - A number, which is a scale factor (the default size is 100).") + - A number, which is a scale factor (the default size is 1).") (defvar image-transform-rotation 0.0 "Rotation angle for the image in the current Image mode buffer.") @@ -655,8 +655,8 @@ compiled with ImageMagick support." (height (cond ((numberp image-transform-resize) - (unless (= image-transform-resize 100) - (* image-transform-resize (cdr size)))) + (unless (= image-transform-resize 1) + (floor (* image-transform-resize (cdr size))))) ((eq image-transform-resize 'fit-height) (- (nth 3 (window-inside-pixel-edges)) (nth 1 (window-inside-pixel-edges)))))) @@ -669,7 +669,6 @@ compiled with ImageMagick support." ,@(if (not (equal 0.0 image-transform-rotation)) (list :rotation image-transform-rotation)))))) -;; FIXME 2 works, but eg 1.9 or 0.5 don't? (defun image-transform-set-scale (scale) "Prompt for a number, and resize the current image by that amount. This command has no effect unless Emacs is compiled with -- 2.39.2