On Fri, 30 Apr 2021 20:54:01 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:
>> src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java line >> 1146: >> >>> 1144: } >>> 1145: Map<Integer, Image> multiResolutionIcon = new HashMap<>(); >>> 1146: int start = size > MAX_QUALITY_ICON ? >>> ICON_RESOLUTIONS.length - 1 : 0; >> >> Does it make sense to always start at zero? >> The icons of smaller size will never be used, will they? >> Thus it's safe to start at the index which corresponds to the requested size >> if `size` matches, or the index such as `ICON_RESOLUTIONS[index] < size && >> ICON_RESOLUTIONS[index + 1] > size`. > > This comment is also about the case of not fetching icons of sizes smaller > than requested size. Sorry, missed that in my latest fix. Indeed there is no legitimate ways to set scaling factor to less than 100% on Windows so yes, omitting the icons that are less than expected size. As for starting the count from the correct index - to get the correct index we would have to traverse the array of possible resolutions anyways so there is no performance gain. ------------- PR: https://git.openjdk.java.net/jdk/pull/2875