On Tue, 11 May 2021 18:48:31 GMT, Alexander Zuev <[email protected]> wrote:
>> src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java line
>> 1196:
>>
>>> 1194: Image icon = makeIcon(hIcon);
>>> 1195: disposeIcon(hIcon);
>>> 1196: return icon;
>>
>> Shall it not be wrapped into multi-resolution image if the `size` is
>> different from the actual size of the icon?
>> Previously, it was inside `makeIcon`.
>
> Wherever it is necessary down the line we are wrapping the result in
> multi-resolution and if we wrap it here too we will have multi-resolution
> icon that contains multi-resolution images as a resolution variant.
> Unfortunately AWT can't handle painting of such abomination.
No, it isn't wrapped: if `getShell32Icon` is called in `getIcon(final boolean
getLargeIcon)`, the returned value is immediately returned to the caller, see
lines 1157–1163 in the updated code:
if (hIcon <= 0) {
if (isDirectory()) {
return getShell32Icon(FOLDER_ICON_ID, size);
} else {
return getShell32Icon(FILE_ICON_ID, size);
}
}
It's not wrapped into multi-resolution icon when called from
`Win32ShellFolder2.get()` for keys `shell32Icon *` and `shell32LargeIcon *`
(lines 411/413–414).
Neither is the returned value of `Win32ShellFolder2.getSystemIcon` wrapped;
it's also called from `Win32ShellFolder2.get()` when getting icons for
`optionPaneIcon *` (lines 405/407). These icons are supposed to be large 32×32
icons, thus if the size of the icon in `getSystemIcon(SystemIcon iconType)`
differs from 32, it should be wrapped. Otherwise, it could cause regression for
[JDK-8151385](https://bugs.openjdk.java.net/browse/JDK-8151385): _[hidpi]
JOptionPane-Icons only partially visible when using Windows 10 L&F_.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2875