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 22:57:58 +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=047d7bdca91a49f5ac04d75da397 X-Trace: ger.gmane.org 1362697119 8101 80.91.229.3 (7 Mar 2013 22:58:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Mar 2013 22:58:39 +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 23:59:02 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 1UDjm7-00059x-2b for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 23:58:59 +0100 Original-Received: from localhost ([::1]:37836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDjlk-0008LN-Uw for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 17:58:36 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDjlf-0008LH-IG for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 17:58:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDjlc-0007ow-In for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 17:58:31 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDjlc-0007os-FQ for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 17:58:28 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UDjm9-00079f-VD for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 17:59:01 -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 22:59:01 +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.136269712127473 (code B ref 13887); Thu, 07 Mar 2013 22:59:01 +0000 Original-Received: (at 13887) by debbugs.gnu.org; 7 Mar 2013 22:58:41 +0000 Original-Received: from localhost ([127.0.0.1]:37334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDjlo-000793-Tx for submit@debbugs.gnu.org; Thu, 07 Mar 2013 17:58:41 -0500 Original-Received: from mail-qc0-f182.google.com ([209.85.216.182]:49003) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDjll-00078q-Lt for 13887@debbugs.gnu.org; Thu, 07 Mar 2013 17:58:38 -0500 Original-Received: by mail-qc0-f182.google.com with SMTP id k19so342363qcs.41 for <13887@debbugs.gnu.org>; Thu, 07 Mar 2013 14:57:58 -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=ria/GsUdCs3/0i/ELy1CQICBMaS03nWNvrAUUCW++q0=; b=VY7IVc27Pf8aUHKBztOANcUER4UKqgPcKW1KfFXXVeaCByIg6Apk9Laocgi3gSNE4t /Mlde/NHFljlipkOpM2YYWCwEAaqNzsxo3UMRVDdQKxMQx/gFR3uxsmqelJLSrC83KyE pbBQBIXV0dK0i1K56+bYunBMzDe5TByz5DjVB09r/WNvUtaAPXJQnLPReFYRxSPGsFYe GWrEeZIabr5SA/yjuw5uAR+lED8otxXYrKqhr7yqUt0Vtmz41QpmFrFj89vg4Lh1ZQF7 yZtX5B7p5b8HARRyK7FobFGCQm+2YoGksGSyXhviBSV14SpjZBjAweyaxw+qtDHHiOlo P2YA== X-Received: by 10.49.132.72 with SMTP id os8mr10087577qeb.52.1362697078304; Thu, 07 Mar 2013 14:57:58 -0800 (PST) Original-Received: by 10.49.70.233 with HTTP; Thu, 7 Mar 2013 14:57:58 -0800 (PST) In-Reply-To: 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:72211 Archived-At: --047d7bdca91a49f5ac04d75da397 Content-Type: text/plain; charset=ISO-8859-1 Couldn't tell the difference to be honest. Evgeni On Thu, Mar 7, 2013 at 4:15 PM, E Sabof wrote: > 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 >> > > --047d7bdca91a49f5ac04d75da397 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Couldn't tell the difference to be honest.

Evgeni


On Thu, Mar 7, 2013 at 4:15 PM, E Sabof <esabof@gmail.com> wr= ote:
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, Ma= r 7, 2013 at 3:55 PM, Tassilo 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 :wi= dth ,doc-view-image-width)))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(apply 'create-im= age 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


--047d7bdca91a49f5ac04d75da397--