Subject: bug#37689: Fringe pixmaps, widgets, etc. look ridiculously tiny in hidpi screen

From: Eli Zaretskii <[email-masked]>
Date: Mon, 14 Oct 2019 11:33:02 +0300

> From: Carlos Pita <[email-masked]>
> Date: Sun, 13 Oct 2019 21:40:14 -0300
> Cc: Robert Pluim <[email-masked]>, [email-masked]
> 
> 1.a. Do the scaling as downstream as possible. The problem with this
> approach is that I will be fixing the problem only for one backend
> (for example, Cairo). Also, I would have to "hack" some assumptions
> done upstream (for example, to adjust x, y and scale of a rectangle
> that is assumed to be of a different geometry by the caller). The
> advantage of the approach is that not only fringe icons but any other
> image that is rendered by the lowest level routine will be properly
> scaled; but, that said, I noticed that in emacs 26.3 widgets are not
> using x_cr_draw_image.
> 
> 1.b. Do the scaling upstream (for example, in get_fringe_bitmap_data
> as proposed above). One problem with this approach is that some
> backend could already be scaling output itself (for example, by using
> a toolkit that automatically scales according to the device
> resolution... do you know if this is the case for windows, for
> macos?). Also, it won't fix the widgets issue (anyway, as I said,
> neither the "downstream" approach will do it in 26.3).

Granted, I prefer the second approach.  We should do as little code
duplication as possible.

I don't think individual backends do any scaling, but if some do, it
should be easy to disable the scaling in our code for those backends.

> 2. I'm clueless regarding were widgets (I mean checkboxes and things
> like that) are rendered. With Cairo backend enabled, x_cr_draw_image
> is never reached in 26.3, its only user is the fringe module, I've
> checked this in the debugger and by inspecting the code. Not sure
> about 27, since tweaking x_cr_draw_image did have a (weird) effect, as
> the screenshots in my previous post show.

I'm not sure I understand how this is related to the issue at hand.
Can you elaborate?

Also, what exactly do you mean by "rendered"?  In Emacs, there are
generally 2 stages of displaying any "display element" (a character,
an image, etc.): first, a backend-independent step of loading the
display element, determining its metrics, and performing the display
layout calculations derived from that; and then backend-dependent step
of actually delivering the display element to the glass.  Which one of
those did you have in mind?

Thanks.