< prev index next >

src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java

Print this page
rev 13901 : Fixes for 8151385. Contains additional fix for 8149453 (upFolder, newFolder, etc. icons)
rev 13629 : 8138838: docs cleanup for java.desktop
Summary: docs cleanup for java.desktop
Reviewed-by: serb
rev 13226 : 8030099: Memory usage of java process increases after pressing start button in test window
Reviewed-by: prr, serb
rev 12267 : 8022057: JFileChooser blocks EDT in Win32ShellFolder2.getIcon
Reviewed-by: serb, ant
rev 12260 : 8017487: filechooser in Windows-Libraries folder: columns are mixed up
Reviewed-by: serb, ant
rev 12117 : 8003399: JFileChooser gives wrong path to selected file when saving to Libraries folder on Windows 7
Reviewed-by: serb, ant
rev 11099 : 8067377: My hobby: caning, then then canning, the the can-can
Summary: Fix ALL the stutters!
Reviewed-by: rriggs, mchung, lancea
rev 10444 : 8054834: Modular Source Code
Reviewed-by: alanb, chegar, ihse, mduigou
Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com

*** 980,1011 **** boolean useVGAColors); // Note: useVGAColors is ignored on XP and later // 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); // Dispose the HICON private static native void disposeIcon(long hIcon); ! static native int[] getStandardViewButton0(int iconIndex); // Should be called from the COM thread private long getIShellIcon() { if (pIShellIcon == -1L) { pIShellIcon = getIShellIcon(getIShellFolder()); } return pIShellIcon; } ! private static Image makeIcon(long hIcon, boolean getLargeIcon) { 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); if (iconBits != null) { ! BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); img.setRGB(0, 0, size, size, iconBits, 0, size); return img; } } return null; --- 980,1013 ---- boolean useVGAColors); // Note: useVGAColors is ignored on XP and later // 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); // Dispose the HICON private static native void disposeIcon(long hIcon); ! // Get buttons from native toolbar implementation. ! static native int[] getStandardViewButton0(int iconIndex, boolean small); // Should be called from the COM thread private long getIShellIcon() { if (pIShellIcon == -1L) { pIShellIcon = getIShellIcon(getIShellFolder()); } return pIShellIcon; } ! 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. ! final int[] iconBits = getIconBits(hIcon); ! // icons are always square ! final int size = (int)Math.sqrt(iconBits.length); if (iconBits != null) { ! final BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); img.setRGB(0, 0, size, size, iconBits, 0, size); return img; } } return null;
*** 1044,1054 **** imageCache = getLargeIcon ? largeSystemImages : smallSystemImages; } newIcon = imageCache.get(Integer.valueOf(index)); if (newIcon == null) { long hIcon = getIcon(getAbsolutePath(), getLargeIcon); ! newIcon = makeIcon(hIcon, getLargeIcon); disposeIcon(hIcon); if (newIcon != null) { imageCache.put(Integer.valueOf(index), newIcon); } } --- 1046,1056 ---- imageCache = getLargeIcon ? largeSystemImages : smallSystemImages; } newIcon = imageCache.get(Integer.valueOf(index)); if (newIcon == null) { long hIcon = getIcon(getAbsolutePath(), getLargeIcon); ! newIcon = makeIcon(hIcon); disposeIcon(hIcon); if (newIcon != null) { imageCache.put(Integer.valueOf(index), newIcon); } }
*** 1069,1079 **** } else { return getShell32Icon(1, getLargeIcon); } } } ! newIcon = makeIcon(hIcon, getLargeIcon); disposeIcon(hIcon); } if (newIcon == null) { newIcon = Win32ShellFolder2.super.getIcon(getLargeIcon); --- 1071,1081 ---- } else { return getShell32Icon(1, getLargeIcon); } } } ! newIcon = makeIcon(hIcon); disposeIcon(hIcon); } if (newIcon == null) { newIcon = Win32ShellFolder2.super.getIcon(getLargeIcon);
*** 1093,1103 **** /** * Gets an icon from the Windows system icon list as an {@code Image} */ static Image getSystemIcon(SystemIcon iconType) { long hIcon = getSystemIcon(iconType.getIconID()); ! Image icon = makeIcon(hIcon, true); disposeIcon(hIcon); return icon; } /** --- 1095,1105 ---- /** * Gets an icon from the Windows system icon list as an {@code Image} */ static Image getSystemIcon(SystemIcon iconType) { long hIcon = getSystemIcon(iconType.getIconID()); ! Image icon = makeIcon(hIcon); disposeIcon(hIcon); return icon; } /**
*** 1114,1124 **** useVGAColors = shellIconBPP.equals("4"); } long hIcon = getIconResource("shell32.dll", iconID, size, size, useVGAColors); if (hIcon != 0) { ! Image icon = makeIcon(hIcon, getLargeIcon); disposeIcon(hIcon); return icon; } return null; } --- 1116,1126 ---- useVGAColors = shellIconBPP.equals("4"); } long hIcon = getIconResource("shell32.dll", iconID, size, size, useVGAColors); if (hIcon != 0) { ! Image icon = makeIcon(hIcon); disposeIcon(hIcon); return icon; } return null; }
< prev index next >