aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2011-01-05 22:17:51 +0100
committerTassilo Horn2011-01-05 22:17:51 +0100
commit875c044ae22139b0cf36d99ccf7009d038296fea (patch)
tree9b3a133f8053b925f068b23c79f835570c69c699
parent2018939f5da2c3171825ea1699cea4ff4f52b71c (diff)
downloademacs-875c044ae22139b0cf36d99ccf7009d038296fea.tar.gz
emacs-875c044ae22139b0cf36d99ccf7009d038296fea.zip
* doc-view.el (doc-view-image-width): New variable.
(doc-view-enlarge, doc-view-insert-image): Prefer imagemagick backend for PNG images, and do dynamic rescaling instead of reconverting the whole doc.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/doc-view.el26
2 files changed, 29 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b24eae7b4e8..be65508a115 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12011-01-05 Tassilo Horn <tassilo@member.fsf.org>
2
3 * doc-view.el (doc-view-image-width): New variable.
4 (doc-view-enlarge, doc-view-insert-image): Prefer imagemagick
5 backend for PNG images, and do dynamic rescaling instead of
6 reconverting the whole doc.
7
12011-01-05 Glenn Morris <rgm@gnu.org> 82011-01-05 Glenn Morris <rgm@gnu.org>
2 9
3 * emacs-lisp/rx.el (rx-repeat): Replace CL function. 10 * emacs-lisp/rx.el (rx-repeat): Replace CL function.
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 801cddd1620..7ec8b3954e0 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -168,6 +168,12 @@ Higher values result in larger images."
168 :type 'number 168 :type 'number
169 :group 'doc-view) 169 :group 'doc-view)
170 170
171(defcustom doc-view-image-width 850
172 "Default image width.
173Has only an effect if imagemagick support is compiled into emacs."
174 :type 'number
175 :group 'doc-view)
176
171(defcustom doc-view-dvipdfm-program (executable-find "dvipdfm") 177(defcustom doc-view-dvipdfm-program (executable-find "dvipdfm")
172 "Program to convert DVI files to PDF. 178 "Program to convert DVI files to PDF.
173 179
@@ -641,9 +647,17 @@ OpenDocument format)."
641(defun doc-view-enlarge (factor) 647(defun doc-view-enlarge (factor)
642 "Enlarge the document." 648 "Enlarge the document."
643 (interactive (list doc-view-shrink-factor)) 649 (interactive (list doc-view-shrink-factor))
644 (set (make-local-variable 'doc-view-resolution) 650 (if (eq (plist-get (cdr (doc-view-current-image)) :type)
645 (* factor doc-view-resolution)) 651 'imagemagick)
646 (doc-view-reconvert-doc)) 652 ;; ImageMagick supports on-the-fly-rescaling
653 (progn
654 (set (make-local-variable 'doc-view-image-width)
655 (ceiling (* factor doc-view-image-width)))
656 (doc-view-insert-image (plist-get (cdr (doc-view-current-image)) :file)
657 :width doc-view-resolution))
658 (set (make-local-variable 'doc-view-resolution)
659 (ceiling (* factor doc-view-resolution)))
660 (doc-view-reconvert-doc)))
647 661
648(defun doc-view-shrink (factor) 662(defun doc-view-shrink (factor)
649 "Shrink the document." 663 "Shrink the document."
@@ -949,7 +963,11 @@ ARGS is a list of image descriptors."
949 (setq doc-view-pending-cache-flush nil)) 963 (setq doc-view-pending-cache-flush nil))
950 (let ((ol (doc-view-current-overlay)) 964 (let ((ol (doc-view-current-overlay))
951 (image (if (and file (file-readable-p file)) 965 (image (if (and file (file-readable-p file))
952 (apply 'create-image file 'png nil args))) 966 (if (not (fboundp 'imagemagick-types))
967 (apply 'create-image file 'png nil args)
968 (unless (member :width args)
969 (setq args (append args (list :width doc-view-image-width))))
970 (apply 'create-image file 'imagemagick nil args))))
953 (slice (doc-view-current-slice))) 971 (slice (doc-view-current-slice)))
954 (setf (doc-view-current-image) image) 972 (setf (doc-view-current-image) image)
955 (move-overlay ol (point-min) (point-max)) 973 (move-overlay ol (point-min) (point-max))