From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: E Sabof Newsgroups: gmane.emacs.bugs Subject: bug#13887: 24.3; doc-view will render blurry images when image-magick is available Date: Thu, 7 Mar 2013 16:15:55 +0000 Message-ID: References: <8762153qc8.fsf@thinkpad.tsdh.de> <8762143co6.fsf@thinkpad.tsdh.de> <877glkgvqj.fsf@thinkpad.tsdh.de> <87txonw6ev.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3074b47279a09a04d75805aa X-Trace: ger.gmane.org 1362673025 27645 80.91.229.3 (7 Mar 2013 16:17:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Mar 2013 16:17:05 +0000 (UTC) Cc: 13887@debbugs.gnu.org To: Tassilo Horn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 07 17:17:28 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UDdVK-0006L5-Em for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 17:17:14 +0100 Original-Received: from localhost ([::1]:34245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDdUy-0005H0-Kr for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 11:16:52 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDdUh-0004rv-T4 for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 11:16:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDdUc-0000E7-NB for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 11:16:35 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDdUc-0000Dr-KT for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 11:16:30 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UDdV8-0004cg-CZ for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 11:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: E Sabof Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Mar 2013 16:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13887 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13887-submit@debbugs.gnu.org id=B13887.136267300017739 (code B ref 13887); Thu, 07 Mar 2013 16:17:02 +0000 Original-Received: (at 13887) by debbugs.gnu.org; 7 Mar 2013 16:16:40 +0000 Original-Received: from localhost ([127.0.0.1]:36756 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDdUk-0004c2-0J for submit@debbugs.gnu.org; Thu, 07 Mar 2013 11:16:39 -0500 Original-Received: from mail-qe0-f42.google.com ([209.85.128.42]:59920) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDdUg-0004bh-9F for 13887@debbugs.gnu.org; Thu, 07 Mar 2013 11:16:36 -0500 Original-Received: by mail-qe0-f42.google.com with SMTP id f6so379432qej.29 for <13887@debbugs.gnu.org>; Thu, 07 Mar 2013 08:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=XqqvVNIs+pO41alazNef7Mb1xzJihjuFvAmkvroDiT8=; b=zvBsWuqu3FL+tnzs7/6/6BG7Dmd0aXbDT/lFa537DfGSvOtdi9FtQlN8QwKy5hT4OS 7CpSGYBnprRTg2dQFD43ieLPGGBfQkbR9SnaMx0QaX3/1RFzwANxCucRtqC2hN91ObvE ZS+KT8lDBfhO2mp2Q0dlftsikJ+8rPFdBschXYcgeuxiiX5AXhB+Uibs1vV/gQKRW3V1 u3WFjFBZHoK9WNDm3bHBfoFV3BciY3LDy/Bn4mIdZDK0v3VTHd8zsNcMRHGBcR8DA6mv k1wEyMqTuiN2GQWAChR08B8MtcVRMnTZB7h4uKDkFbLJAuYHMXxzjlZ7TyI69BQ0XKlC JfvQ== X-Received: by 10.224.117.66 with SMTP id p2mr8199872qaq.45.1362672955791; Thu, 07 Mar 2013 08:15:55 -0800 (PST) Original-Received: by 10.49.70.233 with HTTP; Thu, 7 Mar 2013 08:15:55 -0800 (PST) In-Reply-To: <87txonw6ev.fsf@thinkpad.tsdh.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:72203 Archived-At: --20cf3074b47279a09a04d75805aa Content-Type: text/plain; charset=ISO-8859-1 I mean pressing + or - moves the page horizontally, instead of changing the size. I think the way it opens the document is ok. I'll have a look at the patch and let you know. Evgeni On Thu, Mar 7, 2013 at 3:55 PM, Tassilo Horn wrote: > E Sabof 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 > --20cf3074b47279a09a04d75805aa Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I mean pressing + or - moves the page horizontally, instea= d of changing the size. I think the way it opens the document is ok.
I'll have a look at the patch and let you know.

Evgeni


On Thu, Mar 7, 2013 at 3:55 PM, Tassil= o Horn <tsdh@gnu.org> wrote:
E Sabof <esabof@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. =A0When switching pages, the current hscroll is preserved and I consider that a good thing. =A0It 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. =A0That should be fixed by this version of the patch.

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

Bye,
Tassilo

--20cf3074b47279a09a04d75805aa--