[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-imag
From: |
Tassilo Horn |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable. |
Date: |
Wed, 05 Jan 2011 22:17:51 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 102764
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Wed 2011-01-05 22:17:51 +0100
message:
* 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.
modified:
lisp/ChangeLog
lisp/doc-view.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-01-05 07:04:51 +0000
+++ b/lisp/ChangeLog 2011-01-05 21:17:51 +0000
@@ -1,3 +1,10 @@
+2011-01-05 Tassilo Horn <address@hidden>
+
+ * 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.
+
2011-01-05 Glenn Morris <address@hidden>
* emacs-lisp/rx.el (rx-repeat): Replace CL function.
=== modified file 'lisp/doc-view.el'
--- a/lisp/doc-view.el 2010-12-30 18:08:18 +0000
+++ b/lisp/doc-view.el 2011-01-05 21:17:51 +0000
@@ -168,6 +168,12 @@
:type 'number
:group 'doc-view)
+(defcustom doc-view-image-width 850
+ "Default image width.
+Has only an effect if imagemagick support is compiled into emacs."
+ :type 'number
+ :group 'doc-view)
+
(defcustom doc-view-dvipdfm-program (executable-find "dvipdfm")
"Program to convert DVI files to PDF.
@@ -641,9 +647,17 @@
(defun doc-view-enlarge (factor)
"Enlarge the document."
(interactive (list doc-view-shrink-factor))
- (set (make-local-variable 'doc-view-resolution)
- (* factor doc-view-resolution))
- (doc-view-reconvert-doc))
+ (if (eq (plist-get (cdr (doc-view-current-image)) :type)
+ 'imagemagick)
+ ;; ImageMagick supports on-the-fly-rescaling
+ (progn
+ (set (make-local-variable 'doc-view-image-width)
+ (ceiling (* factor doc-view-image-width)))
+ (doc-view-insert-image (plist-get (cdr (doc-view-current-image)) :file)
+ :width doc-view-resolution))
+ (set (make-local-variable 'doc-view-resolution)
+ (ceiling (* factor doc-view-resolution)))
+ (doc-view-reconvert-doc)))
(defun doc-view-shrink (factor)
"Shrink the document."
@@ -949,7 +963,11 @@
(setq doc-view-pending-cache-flush nil))
(let ((ol (doc-view-current-overlay))
(image (if (and file (file-readable-p file))
- (apply 'create-image file 'png nil args)))
+ (if (not (fboundp 'imagemagick-types))
+ (apply 'create-image file 'png nil args)
+ (unless (member :width args)
+ (setq args (append args (list :width
doc-view-image-width))))
+ (apply 'create-image file 'imagemagick nil args))))
(slice (doc-view-current-slice)))
(setf (doc-view-current-image) image)
(move-overlay ol (point-min) (point-max))
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable., Tassilo Horn, 2011/01/05
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable., Tassilo Horn, 2011/01/05
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable., Tassilo Horn, 2011/01/05
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable., Tassilo Horn, 2011/01/05
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable., Tassilo Horn, 2011/01/05
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable., Tassilo Horn, 2011/01/05
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable.,
Tassilo Horn <=
- [Emacs-diffs] /srv/bzr/emacs/trunk r102764: * doc-view.el (doc-view-image-width): New variable., Tassilo Horn, 2011/01/06