On Thu, 8 Jun 2023 00:16:27 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

>> So, basically for w,h =19 we calculate a DPI of 140 and Dimension d = 
>> getPartSize(getTheme(widget, dpi), part, state); at line 172 of 
>> ThemeReader.java call returns a part size of 13 x 13 provided by windows as 
>> it is closer to DPI=120 (for 125% scaling).
>> While for  w,h =20 we calculate a DPI of 147 and Dimension d = 
>> getPartSize(getTheme(widget, dpi), part, state); at line 172 of 
>> ThemeReader.java call returns a part size of 20 x 20 provided by windows as 
>> it is closer to DPI=144 (for 150% scaling).
>> Thus part size calculated by us and provided by Windows matches and hence we 
>> see bigger properly rendered buttons while for the w,h=19 case we have 19x19 
>> , while windows gives 13x13 
>> and hence you see scaled down buttons with bad rendering.
>
> Probably I missed something but I would like to clarify. As you mention above 
> we ask Windows to return the image for the component for some specific size, 
> the Windows may return image of exactly requested size if available or any 
> other size. What we will do if the size is different? In the image above it 
> seems we use it as is, but should we? probably we should rescale it?

So, we ask Windows for the component image based on a particular DPI , not some 
specific size.
The basic premise here is that we expect Windows returning image that would 
match the DPI , and then we perform our calculations accordingly. In the case 
above (if Region.clipRound is used) that basic premise is not met (if w, h=19) 
due to us calculating a DPI value of 140 which is closer to 120 or 125% scaling 
while our scaling is acytually 150% and Windows returns us a smaller size of 
the component than expected.
So we don't need to add extra code to rescale , I believe.
If we provide windows with correctly calculated DPI value which my code change 
does it should work fine as Windows will give us image of the correct size.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13701#discussion_r1222316115

Reply via email to