unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24393@debbugs.gnu.org, Tino Calancha <tino.calancha@gmail.com>
Subject: bug#24393: 25.1.50; image-mode ignore the image :scale
Date: Fri, 9 Sep 2016 22:51:04 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1609092220360.16132@calancha-pc> (raw)
In-Reply-To: <837fal8b8x.fsf@gnu.org>



On Fri, 9 Sep 2016, Eli Zaretskii wrote:

>> From: Tino Calancha <tino.calancha@gmail.com>
>> Date: Fri, 9 Sep 2016 19:23:02 +0900 (JST)
>> cc: Tino Calancha <tino.calancha@gmail.com>, 24393@debbugs.gnu.org
>>
>>> 	 ;; If we have a `fit-width' or a `fit-height', don't limit
>>> 	 ;; the size of the image to the window size.
>>> 	 (edges (and (null image-transform-resize)
>>> 		     (window-inside-pixel-edges
>>> 		      (get-buffer-window (current-buffer)))))
>>>
>>> I think 'edges' should be non-nil if image-transform-resize is
>>> non-nil, no?
>> I think is OK.  Maybe i would adjust the comment a bit, because
>> `image-transform-resize' can also be a number (set by
>> `image-transform-set-scale'): i would say:
>> ;; If `image-transform-resize' is non-nil, don't limit
>> ;; the size of the image to the window size.
>>
>> I think the logic is as follows:
>> The proportion width/height is an invariant of this transformation.
>> If you call `image-transform-fit-to-width', your image width will occupy
>> all the window width.  Then, the height is increased in the same
>> proportion as the width, so the final image height may be longer than
>> the window height.  That's OK.
>
> When image-transform-fit-to-width sets image-transform-resize to the
> symbol 'fit-width', image-toggle-display-image will not pass any
> dimensions to create-image.  So how will the image be resized at all
> in this case?  What am I missing?
It is done inside `image-toggle-display-image'.  Maybe the word 'toggle'
inside this function is misleading: indeed it looks more than a toggle.
This 'toggle' calls `image-transform-properties' which calculate the
resize for 'fit-width/'fit-height cases.
> And how do you explain the assertion violation in this case, anyway?
> What are the window dimensions in pixels?
The same 'toggle' calls `image-transform-check-size' to check 
the sizes (do the cl-asserts).

I guess, the origin of the problem is that these functions,
`image-transform-properties' and `image-transform-check-size',
don't use the image scale. After the commit mentioned in my original 
report, the scale of an image matters.  We need somehow to teach 
`image-mode' to use :scale to fix this bug.
We could fix this file amending those functions.  I tried before and
i didn't like this approach.

I also suggested in
https://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00159.html
that if image-mode.el uses more the API in image.el (maybe extending 
the API a bit ), then this bug could get fix easily; currently both
files define resizes and rotations; for me it has much sense that,
if the API already provide those functionalities, then image-mode.el
just use them: one source of truth, easier to maintain.





  reply	other threads:[~2016-09-09 13:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 12:14 bug#24393: 25.1.50; image-mode ignore the image :scale Tino Calancha
2016-09-08 17:15 ` Eli Zaretskii
2016-09-08 18:13   ` Tino Calancha
2016-09-09  8:06     ` Eli Zaretskii
2016-09-09 10:23       ` Tino Calancha
2016-09-09 13:15         ` Eli Zaretskii
2016-09-09 13:51           ` Tino Calancha [this message]
2019-09-26 15:59 ` Lars Ingebrigtsen
2019-09-26 17:42   ` Tino Calancha
2019-09-26 17:49     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1609092220360.16132@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=24393@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).