GNU bug report logs - #13887
24.3; doc-view will render blurry images when image-magick is available

Previous Next

Package: emacs;

Reported by: E Sabof <esabof <at> gmail.com>

Date: Wed, 6 Mar 2013 03:42:02 UTC

Severity: normal

Tags: moreinfo

Found in version 24.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 13887 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: E Sabof <esabof <at> gmail.com>
Cc: 13887 <at> debbugs.gnu.org
Subject: Re: bug#13887: 24.3;
	doc-view will render blurry images when image-magick is available
Date: Thu, 07 Mar 2013 16:55:52 +0100
E Sabof <esabof <at> gmail.com> writes:

> I had a look at it, there are some issues with zooming. It doesn't
> work when I open a document that is larger than the window,

Does that mean that you'd like to set the hscoll when the window is
smaller than the images so that the center of the image is displayed at
the center of the window?

Hm, this could at least be done once when initially opening some
document.  When switching pages, the current hscroll is preserved and I
consider that a good thing.  It shouldn't re-center then.

> and sometimes in other cases.

I know there were some issues/errors when the image of a page isn't
there already.  That should be fixed by this version of the patch.

--8<---------------cut here---------------start------------->8---
=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el    2013-02-28 04:02:36 +0000
+++ lisp/doc-view.el    2013-03-07 08:14:09 +0000
@@ -1250,7 +1250,7 @@
   (when doc-view-pending-cache-flush
     (clear-image-cache)
     (setq doc-view-pending-cache-flush nil))
-  (let ((ol (doc-view-current-overlay))
+  (let* ((ol (doc-view-current-overlay))
         (image (if (and file (file-readable-p file))
                   (if (not (and doc-view-scale-internally
                                  (fboundp 'imagemagick-types)))
@@ -1258,9 +1258,20 @@
                     (unless (member :width args)
                       (setq args `(,@args :width ,doc-view-image-width)))
                     (apply 'create-image file 'imagemagick nil args))))
-        (slice (doc-view-current-slice)))
+        (slice (doc-view-current-slice))
+        (img-width (and image (car (image-size image))))
+        (displayed-img-width (if (and image slice)
+                                 (* (/ (float (nth 2 slice))
+                                       (car (image-size image 'pixels)))
+                                    img-width)
+                               img-width))
+        (window-width (window-width (selected-window))))
     (setf (doc-view-current-image) image)
     (move-overlay ol (point-min) (point-max))
+    (when (and image (> window-width displayed-img-width))
+      (overlay-put ol 'before-string
+                  (propertize " " 'display
+                              `(space :align-to (+ center (-0.5 . ,displayed-img-width))))))
     (overlay-put ol 'display
                  (cond
                   (image
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo




This bug report was last modified 5 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.