dlls/shell32/iconcache.c (resubmit)

Ge van Geldorp gvg at reactos.com
Tue Sep 13 02:01:35 CDT 2005


http://www.winehq.org/pipermail/wine-patches/2005-September/020553.html seems
to be MIA

Changelog:
  Ge van Geldorp <gvg at reactos.com>
  - Save a few megabytes of memory by loading the default icon only once into
    the image lists

Index: dlls/shell32/iconcache.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/iconcache.c,v
retrieving revision 1.92
diff -u -r1.92 iconcache.c
--- dlls/shell32/iconcache.c	26 Aug 2005 10:05:34 -0000	1.92
+++ dlls/shell32/iconcache.c	8 Sep 2005 12:45:48 -0000
@@ -351,7 +351,17 @@
 
 	if ( INVALID_INDEX == index )
 	{
-	  ret = SIC_LoadIcon (sSourceFile, dwSourceIndex, dwFlags);
+	  if (0 == strcmpiW (sSourceFile, swShell32Name) &&
+	      -IDI_SHELL_MY_DOCUMENTS <= dwSourceIndex &&
+	      dwSourceIndex < IDI_SHELL_MY_DOCUMENTS)
+	  {
+	    /* Return default icon for icons not present in shell32 */
+	    ret = 0;
+	  }
+	  else
+	  {
+	    ret = SIC_LoadIcon (sSourceFile, dwSourceIndex, dwFlags);
+	  }
 	}
 	else
 	{
@@ -404,13 +414,11 @@
 	  hSm = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_small, cy_small, LR_SHARED);
 	  hLg = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, cx_large, cy_large, LR_SHARED);
 
-	  if(!hSm)
+	  if(hSm)
 	  {
-	    hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_small, cy_small, LR_SHARED);
-	    hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_large, cy_large, LR_SHARED);
+            SIC_IconAppend (swShell32Name, index - 1, hSm, hLg, 0);
+            SIC_IconAppend (swShell32Name, -index, hSm, hLg, 0);
 	  }
-         SIC_IconAppend (swShell32Name, index - 1, hSm, hLg, 0);
-         SIC_IconAppend (swShell32Name, -index, hSm, hLg, 0);
 	}
 
 	TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList);



More information about the wine-patches mailing list