Author: gedmurphy
Date: Tue Jan 16 02:23:29 2007
New Revision: 25474
URL:
http://svn.reactos.org/svn/reactos?rev=25474&view=rev
Log:
silence debug message
Modified:
trunk/reactos/dll/win32/user32/windows/icon.c
Modified: trunk/reactos/dll/win32/user32/windows/icon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/icon.c (original)
+++ trunk/reactos/dll/win32/user32/windows/icon.c Tue Jan 16 02:23:29 2007
@@ -505,7 +505,7 @@
}
}
- DPRINT1("Best Icon: ResId: %d, bits : %d\n", BestEntry, BestBits);
+ DPRINT("Best Icon: ResId: %d, bits : %d\n", BestEntry, BestBits);
return BestEntry;
}
@@ -526,39 +526,42 @@
int Height,
int ColorBits)
{
- int i, MaxWidth, MaxHeight, cx, cy, Bits, BestEntry = -1;
-
- /* Double height to account for AND and XOR masks */
- Height *= 2;
-
- /* First find the largest one smaller than or equal to the requested size*/
- MaxWidth = MaxHeight = 0;
+ int i, cx, cy, Bits, BestBits = 0, BestEntry = -1;
+ UINT iTotalDiff, iXDiff=0, iYDiff=0, iColorDiff;
+ UINT iTempXDiff, iTempYDiff, iTempColorDiff;
+
+ /* Find Best Fit */
+ iTotalDiff = 0xFFFFFFFF;
+ iColorDiff = 0xFFFFFFFF;
for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ )
{
- if ((cx <= Width) && (cy <= Height) &&
- (cx > MaxWidth) && (cy > MaxHeight) &&
- (Bits == 1))
+ iTempXDiff = abs(Width - cx);
+ iTempYDiff = abs(Height - cy);
+
+ if(iTotalDiff > (iTempXDiff + iTempYDiff))
{
- BestEntry = i;
- MaxWidth = cx;
- MaxHeight = cy;
+ iXDiff = iTempXDiff;
+ iYDiff = iTempYDiff;
+ iTotalDiff = iXDiff + iYDiff;
}
}
- if (BestEntry != -1)
- return BestEntry;
-
- /* Now find the smallest one larger than the requested size */
- MaxWidth = MaxHeight = 255;
+
+ /* Find Best Colors for Best Fit */
for (i = 0; get_entry(dir, i, &cx, &cy, &Bits); i++ )
{
- if (((cx < MaxWidth) && (cy < MaxHeight) && (Bits == 1))
||
- (BestEntry == -1))
+ if(abs(Width - cx) == iXDiff && abs(Height - cy) == iYDiff)
{
- BestEntry = i;
- MaxWidth = cx;
- MaxHeight = cy;
+ iTempColorDiff = abs(ColorBits - Bits);
+ if(iColorDiff > iTempColorDiff)
+ {
+ BestEntry = i;
+ BestBits = Bits;
+ iColorDiff = iTempColorDiff;
+ }
}
}
+
+ DPRINT("Best Cursor: ResId: %d, bits : %d\n", BestEntry, BestBits);
return BestEntry;
}
@@ -669,7 +672,7 @@
if(bIcon)
entry = CURSORICON_FindBestIconRes(dir, width, height, ColorBits);
else
- entry = CURSORICON_FindBestCursorRes(dir, width, height, 1);
+ entry = CURSORICON_FindBestCursorRes(dir, width, height, ColorBits);
if (entry)
retVal = entry->nID;