--- old/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java 2016-03-07 16:28:42.000000000 +0100 +++ new/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java 2016-03-07 16:28:42.000000000 +0100 @@ -928,7 +928,7 @@ // Return the bits from an HICON. This has a side effect of setting // the imageHash variable for efficient caching / comparing. - private static native int[] getIconBits(long hIcon, int iconSize); + private static native int[] getIconBits(long hIcon); // Dispose the HICON private static native void disposeIcon(long hIcon); @@ -943,13 +943,14 @@ return pIShellIcon; } - private static Image makeIcon(long hIcon, boolean getLargeIcon) { + private static Image makeIcon(long hIcon) { if (hIcon != 0L && hIcon != -1L) { // Get the bits. This has the side effect of setting the imageHash value for this object. - int size = getLargeIcon ? 32 : 16; - int[] iconBits = getIconBits(hIcon, size); + final int[] iconBits = getIconBits(hIcon); + // icons are always square + final int size = (int)Math.sqrt(iconBits.length); if (iconBits != null) { - BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); + final BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); img.setRGB(0, 0, size, size, iconBits, 0, size); return img; } @@ -986,7 +987,7 @@ newIcon = (Image) imageCache.get(Integer.valueOf(index)); if (newIcon == null) { long hIcon = getIcon(getAbsolutePath(), getLargeIcon); - newIcon = makeIcon(hIcon, getLargeIcon); + newIcon = makeIcon(hIcon); disposeIcon(hIcon); if (newIcon != null) { imageCache.put(Integer.valueOf(index), newIcon); @@ -999,7 +1000,7 @@ // These are only cached per object long hIcon = extractIcon(getParentIShellFolder(), getRelativePIDL(), getLargeIcon); - newIcon = makeIcon(hIcon, getLargeIcon); + newIcon = makeIcon(hIcon); disposeIcon(hIcon); } @@ -1023,7 +1024,7 @@ */ static Image getSystemIcon(SystemIcon iconType) { long hIcon = getSystemIcon(iconType.getIconID()); - Image icon = makeIcon(hIcon, true); + Image icon = makeIcon(hIcon); disposeIcon(hIcon); return icon; } @@ -1044,7 +1045,7 @@ long hIcon = getIconResource("shell32.dll", iconID, size, size, useVGAColors); if (hIcon != 0) { - Image icon = makeIcon(hIcon, getLargeIcon); + Image icon = makeIcon(hIcon); disposeIcon(hIcon); return icon; }