From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#13887: 24.3; doc-view will render blurry images when image-magick is available Date: Thu, 07 Mar 2013 16:55:52 +0100 Message-ID: <87txonw6ev.fsf@thinkpad.tsdh.de> References: <8762153qc8.fsf@thinkpad.tsdh.de> <8762143co6.fsf@thinkpad.tsdh.de> <877glkgvqj.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362671796 15035 80.91.229.3 (7 Mar 2013 15:56:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Mar 2013 15:56:36 +0000 (UTC) Cc: 13887@debbugs.gnu.org To: E Sabof Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 07 16:57:00 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 1UDdBj-0004Hh-0f for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 16:56:59 +0100 Original-Received: from localhost ([::1]:40867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDdBN-0008QL-CT for geb-bug-gnu-emacs@m.gmane.org; Thu, 07 Mar 2013 10:56:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDdBI-0008QF-Kk for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 10:56:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDdBH-0001gl-4S for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 10:56:32 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDdBH-0001gc-0o for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 10:56:31 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UDdBm-0004Ar-KR for bug-gnu-emacs@gnu.org; Thu, 07 Mar 2013 10:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Mar 2013 15:57: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.136267179616014 (code B ref 13887); Thu, 07 Mar 2013 15:57:02 +0000 Original-Received: (at 13887) by debbugs.gnu.org; 7 Mar 2013 15:56:36 +0000 Original-Received: from localhost ([127.0.0.1]:36730 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDdBK-0004AD-Pg for submit@debbugs.gnu.org; Thu, 07 Mar 2013 10:56:36 -0500 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:33264) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDdBG-0004A1-V8 for 13887@debbugs.gnu.org; Thu, 07 Mar 2013 10:56:32 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id D8B2E1A84A6; Thu, 7 Mar 2013 16:55:57 +0100 (CET) X-Virus-Scanned: amavisd-new at uni-koblenz.de Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aEJdGFAWcWY6; Thu, 7 Mar 2013 16:55:57 +0100 (CET) X-CHKRCPT: Envelopesender noch tsdh@gnu.org Original-Received: from thinkpad.tsdh.de (tsdh.uni-koblenz.de [141.26.67.142]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 6743A1A84A5; Thu, 7 Mar 2013 16:55:57 +0100 (CET) In-Reply-To: (E. Sabof's message of "Thu, 7 Mar 2013 15:17:54 +0000") User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) 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:72201 Archived-At: 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