- Fixed icon lookup so that in high color video modes colorfull icons are used.

svn path=/trunk/; revision=8334
This commit is contained in:
Filip Navara 2004-02-23 18:16:37 +00:00
parent f493ab9cc7
commit 7a4c78bd4d
2 changed files with 14 additions and 12 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: bitmap.c,v 1.26 2003/12/31 19:25:51 navaraf Exp $ /* $Id: bitmap.c,v 1.27 2004/02/23 18:16:37 navaraf Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c * FILE: lib/user32/windows/input.c
@ -94,7 +94,7 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
GRPCURSORICONDIR* IconResDir; GRPCURSORICONDIR* IconResDir;
INT id; INT id;
ICONIMAGE *ResIcon; ICONIMAGE *ResIcon;
UINT Colors; UINT ColorBits;
if (!(fuLoad & LR_LOADFROMFILE)) if (!(fuLoad & LR_LOADFROMFILE))
{ {
@ -200,19 +200,21 @@ LoadCursorImage(HINSTANCE hinst, LPCWSTR lpszName, UINT fuLoad)
if (fuLoad & LR_MONOCHROME) if (fuLoad & LR_MONOCHROME)
{ {
Colors = 2; ColorBits = 1;
} }
else else
{ {
Colors = GetDeviceCaps(hScreenDc, BITSPIXEL); ColorBits = GetDeviceCaps(hScreenDc, BITSPIXEL);
if (Colors > 8) /*
Colors = 256; * FIXME:
else * Remove this after proper support for alpha icons will be finished.
Colors = 1 << Colors; */
if (ColorBits > 8)
ColorBits = 8;
} }
/* Pick the best size. */ /* Pick the best size. */
dirEntry = (CURSORICONDIRENTRY *)CURSORICON_FindBestIcon(IconDIR, 32, 32, Colors); dirEntry = (CURSORICONDIRENTRY *)CURSORICON_FindBestIcon(IconDIR, 32, 32, ColorBits);
if (!dirEntry) if (!dirEntry)
{ {
UnmapViewOfFile(IconDIR); UnmapViewOfFile(IconDIR);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: icon.c,v 1.18 2004/01/23 23:38:26 ekohl Exp $ /* $Id: icon.c,v 1.19 2004/02/23 18:16:37 navaraf Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/icon.c * FILE: lib/user32/windows/icon.c
@ -505,7 +505,7 @@ CURSORICON_FindBestCursor( GRPCURSORICONDIR *dir, int width, int height, int col
/* Ported from WINE20030408 */ /* Ported from WINE20030408 */
GRPCURSORICONDIRENTRY* GRPCURSORICONDIRENTRY*
CURSORICON_FindBestIcon( GRPCURSORICONDIR *dir, int width, int height, int colors) CURSORICON_FindBestIcon( GRPCURSORICONDIR *dir, int width, int height, int colorbits)
{ {
int i; int i;
GRPCURSORICONDIRENTRY *entry, *bestEntry = NULL; GRPCURSORICONDIRENTRY *entry, *bestEntry = NULL;
@ -543,7 +543,7 @@ CURSORICON_FindBestIcon( GRPCURSORICONDIR *dir, int width, int height, int color
if(abs(width - entry->ResInfo.icon.bWidth) == (int) iXDiff && if(abs(width - entry->ResInfo.icon.bWidth) == (int) iXDiff &&
abs(height - entry->ResInfo.icon.bHeight) == (int) iYDiff) abs(height - entry->ResInfo.icon.bHeight) == (int) iYDiff)
{ {
iTempColorDiff = abs(colors - entry->ResInfo.icon.bColorCount); iTempColorDiff = abs(colorbits - entry->wBitCount);
if(iColorDiff > iTempColorDiff) if(iColorDiff > iTempColorDiff)
{ {
bestEntry = entry; bestEntry = entry;