Fix loading icon from resource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some icons were not loaded correctly sometimes. I found it came from the
fact we must use the wBitCount field of CURSORICONDIRENTRY instead of
the bColorCount. 
Actually, bColorCount is 0 if >=8bpp (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_icons.asp )

Now all the icon in the tabs are displayed correctly in emule :) (and in
many other apps I think).

a+

Max

ChangeLog:
   * Fix some indentation
   * Fix the loading of icon resources 
-- 
Maxime Bellengà <maxime.bellenge@laposte.net>
Index: wine/windows/cursoricon.c
===================================================================
RCS file: /home/wine/wine/windows/cursoricon.c,v
retrieving revision 1.62
diff -u -r1.62 cursoricon.c
--- wine/windows/cursoricon.c	12 Dec 2002 23:34:01 -0000	1.62
+++ wine/windows/cursoricon.c	29 Apr 2003 09:12:03 -0000
@@ -24,7 +24,7 @@
 /*
  * Theory:
  *
- * http://www.microsoft.com/win32dev/ui/icons.htm
+ * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwui/html/msdn_icons.asp
  *
  * Cursors and icons are stored in a global heap block, with the
  * following layout:
@@ -310,15 +310,15 @@
     iColorDiff = 0xFFFFFFFF;
     for (i = 0, entry = &dir->idEntries[0]; i < dir->idCount; i++,entry++)
         {
-	iTempXDiff = abs(width - entry->ResInfo.icon.bWidth);
-	iTempYDiff = abs(height - entry->ResInfo.icon.bHeight);
-
-        if(iTotalDiff > (iTempXDiff + iTempYDiff))
-        {
-            iXDiff = iTempXDiff;
-            iYDiff = iTempYDiff;
-	    iTotalDiff = iXDiff + iYDiff;
-        }
+	  iTempXDiff = abs(width - entry->ResInfo.icon.bWidth);
+	  iTempYDiff = abs(height - entry->ResInfo.icon.bHeight);
+	  
+	  if(iTotalDiff > (iTempXDiff + iTempYDiff))
+	    {
+	      iXDiff = iTempXDiff;
+	      iYDiff = iTempYDiff;
+	      iTotalDiff = iXDiff + iYDiff;
+	    }
         }
 
     /* Find Best Colors for Best Fit */
@@ -327,12 +327,12 @@
         if(abs(width - entry->ResInfo.icon.bWidth) == iXDiff &&
             abs(height - entry->ResInfo.icon.bHeight) == iYDiff)
         {
-            iTempColorDiff = abs(colors - entry->ResInfo.icon.bColorCount);
-            if(iColorDiff > iTempColorDiff)
-        {
-            bestEntry = entry;
-                iColorDiff = iTempColorDiff;
-        }
+	  iTempColorDiff = abs(colors - (1<<entry->wBitCount));
+	  if(iColorDiff > iTempColorDiff)
+	    {
+	      bestEntry = entry;
+	      iColorDiff = iTempColorDiff;
+	    }
         }
     }
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux