GNU bug report logs -
#13887
24.3; doc-view will render blurry images when image-magick is available
Previous Next
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
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
With this patch I don't get an overlay in the initial window, and sometimes
after splitting. Redefining image-get-display-property as in my previous
patch fixes the splitting problem.
Evgeni
On Thu, Mar 14, 2013 at 7:24 AM, Tassilo Horn <tsdh <at> gnu.org> wrote:
> E Sabof <esabof <at> gmail.com> writes:
>
> > The first time (doc-view-insert-image) is called, the doc-view buffer
> > isn't selected, and (doc-view-current-overlay) returns the t overlay.
> >
> > The "fake" overlay gets "resurrected" when (doc-view-insert-image)
> > calls (move-overlay) on it.
>
> Thanks Evgeni, I think that brought me on track. Could you please
> test-drive this patch (which also contains the centering stuff) and
> check if the issue is fixed by it? It seems it is for me, but I only
> did some very brief testing.
>
> --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-14 07:21:18 +0000
> @@ -1250,17 +1250,33 @@
> (when doc-view-pending-cache-flush
> (clear-image-cache)
> (setq doc-view-pending-cache-flush nil))
> - (let ((ol (doc-view-current-overlay))
> - (image (if (and file (file-readable-p file))
> + (let ((ol (doc-view-current-overlay)))
> + ;; ol might be a deleted (see `doc-view-new-window-function'), in
> + ;; which case we don't want to modify it.
> + (when (overlay-buffer ol)
> + (let* ((image (if (and file (file-readable-p file))
> (if (not (and doc-view-scale-internally
> (fboundp 'imagemagick-types)))
> (apply 'create-image file doc-view--image-type nil
> args)
> (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))
> + ;; In case the window is wider than the image, center the image
> + ;; horizontally.
> + (overlay-put ol 'before-string
> + (when (and image (> window-width displayed-img-width))
> + (propertize " " 'display
> + `(space :align-to (+ center (-0.5 .
> ,displayed-img-width))))))
> (overlay-put ol 'display
> (cond
> (image
> @@ -1287,7 +1303,7 @@
> (vscroll (image-mode-window-get 'vscroll win)))
> ;; Reset scroll settings, in case they were changed.
> (if hscroll (set-window-hscroll win hscroll))
> - (if vscroll (set-window-vscroll win vscroll)))))))
> + (if vscroll (set-window-vscroll win vscroll)))))))))
>
> (defun doc-view-sort (a b)
> "Return non-nil if A should be sorted before B.
> --8<---------------cut here---------------end--------------->8---
>
> Bye,
> Tassilo
>
[Message part 2 (text/html, inline)]
This bug report was last modified 5 years and 224 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.