<AWT Dev> RFR: 8182043: Access to Windows Large Icons

Alexander Zuev kizune at openjdk.java.net
Thu Apr 29 17:06:58 UTC 2021


On Wed, 10 Mar 2021 20:27:44 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Fix updated after first round of review.
>
> src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java line 1114:
> 
>> 1112:                                     bothIcons.put(getLargeIcon? SMALL_ICON_SIZE : LARGE_ICON_SIZE, newIcon2);
>> 1113:                                     newIcon = new MultiResolutionIconImage(getLargeIcon ? LARGE_ICON_SIZE
>> 1114:                                             : SMALL_ICON_SIZE, bothIcons);
> 
> I still propose to refactor this code to make it clearer. The code always returns two icons: _small + large_ or _large + small_ — combined in `MultiResolutionIconImage`.
> 
> You can get `smallIcon` and `largeIcon` and then wrap them into `MultiResolutionIconImage` in the correct order and store each icon in the cache.
> 
> My opinion hasn't changed here.
> 
> I still think there's not much value in getting smaller icon size in addition to larger one. Or does it provide an alternative image for the case where the system scaling is 200% and the window is moved to a monitor with scaling of 100%?

Getting smaller icon is relevant in the case of the scaling. I do not think refactoring image caches from icons to multiresolution images will make code much cleaner - at the end we will have to extract images from the multiresolution image to repack them into different multiresolution image because the base size of the image will not be the same and it does matter in how they will be scaled on the different screens. And we still need to extract both images because sometimes small resolution image looks not like the large resolution one and for a reason - so small resolution image is not blurred by the small detail on the large icon when scaling on the low resolution screen.

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

PR: https://git.openjdk.java.net/jdk/pull/2875


More information about the awt-dev mailing list