From a660c7903f0fc612d49b12a7f84be045b9043f2a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 3 Jun 2000 20:45:20 +0000 Subject: [PATCH] Moved DIB_FixColorsToLoadflags to cursoricon.c. --- include/bitmap.h | 1 - objects/dib.c | 66 ------------------------------------------- windows/cursoricon.c | 67 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 67 deletions(-) diff --git a/include/bitmap.h b/include/bitmap.h index d8ed08b5dc0..2ac89bf7117 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -57,7 +57,6 @@ extern HBITMAP DIB_CreateDIBSection( HDC hdc, BITMAPINFO *bmi, UINT usage, LPVOI extern void DIB_UpdateDIBSection( DC *dc, BOOL toDIB ); extern void DIB_DeleteDIBSection( BITMAPOBJ *bmp ); extern void DIB_SelectDIBSection( DC *dc, BITMAPOBJ *bmp ); -extern void DIB_FixColorsToLoadflags(BITMAPINFO * bmi, UINT loadflags, BYTE pix); extern HGLOBAL DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp); #endif /* __WINE_BITMAP_H */ diff --git a/objects/dib.c b/objects/dib.c index 0640bb9fa66..4a01138d05a 100644 --- a/objects/dib.c +++ b/objects/dib.c @@ -930,72 +930,6 @@ void DIB_DeleteDIBSection( BITMAPOBJ *bmp ) } } -/*********************************************************************** - * DIB_FixColorsToLoadflags - * - * Change color table entries when LR_LOADTRANSPARENT or LR_LOADMAP3DCOLORS - * are in loadflags - */ -void DIB_FixColorsToLoadflags(BITMAPINFO * bmi, UINT loadflags, BYTE pix) -{ - int colors; - COLORREF c_W, c_S, c_F, c_L, c_C; - int incr,i; - RGBQUAD *ptr; - - if (bmi->bmiHeader.biBitCount > 8) return; - if (bmi->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) incr = 4; - else if (bmi->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) incr = 3; - else { - WARN("Wrong bitmap header size!\n"); - return; - } - colors = bmi->bmiHeader.biClrUsed; - if (!colors && (bmi->bmiHeader.biBitCount <= 8)) - colors = 1 << bmi->bmiHeader.biBitCount; - c_W = GetSysColor(COLOR_WINDOW); - c_S = GetSysColor(COLOR_3DSHADOW); - c_F = GetSysColor(COLOR_3DFACE); - c_L = GetSysColor(COLOR_3DLIGHT); - if (loadflags & LR_LOADTRANSPARENT) { - switch (bmi->bmiHeader.biBitCount) { - case 1: pix = pix >> 7; break; - case 4: pix = pix >> 4; break; - case 8: break; - default: - WARN("(%d): Unsupported depth\n", bmi->bmiHeader.biBitCount); - return; - } - if (pix >= colors) { - WARN("pixel has color index greater than biClrUsed!\n"); - return; - } - if (loadflags & LR_LOADMAP3DCOLORS) c_W = c_F; - ptr = (RGBQUAD*)((char*)bmi->bmiColors+pix*incr); - ptr->rgbBlue = GetBValue(c_W); - ptr->rgbGreen = GetGValue(c_W); - ptr->rgbRed = GetRValue(c_W); - } - if (loadflags & LR_LOADMAP3DCOLORS) - for (i=0; ibmiColors+i*incr); - c_C = RGB(ptr->rgbRed, ptr->rgbGreen, ptr->rgbBlue); - if (c_C == RGB(128, 128, 128)) { - ptr->rgbRed = GetRValue(c_S); - ptr->rgbGreen = GetGValue(c_S); - ptr->rgbBlue = GetBValue(c_S); - } else if (c_C == RGB(192, 192, 192)) { - ptr->rgbRed = GetRValue(c_F); - ptr->rgbGreen = GetGValue(c_F); - ptr->rgbBlue = GetBValue(c_F); - } else if (c_C == RGB(223, 223, 223)) { - ptr->rgbRed = GetRValue(c_L); - ptr->rgbGreen = GetGValue(c_L); - ptr->rgbBlue = GetBValue(c_L); - } - } -} - /*********************************************************************** * DIB_CreateDIBFromBitmap * Allocates a packed DIB and copies the bitmap data into it. diff --git a/windows/cursoricon.c b/windows/cursoricon.c index 75a7667fbf0..0a33e82721e 100644 --- a/windows/cursoricon.c +++ b/windows/cursoricon.c @@ -2008,6 +2008,73 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon, return result; } +/*********************************************************************** + * DIB_FixColorsToLoadflags + * + * Change color table entries when LR_LOADTRANSPARENT or LR_LOADMAP3DCOLORS + * are in loadflags + */ +static void DIB_FixColorsToLoadflags(BITMAPINFO * bmi, UINT loadflags, BYTE pix) +{ + int colors; + COLORREF c_W, c_S, c_F, c_L, c_C; + int incr,i; + RGBQUAD *ptr; + + if (bmi->bmiHeader.biBitCount > 8) return; + if (bmi->bmiHeader.biSize == sizeof(BITMAPINFOHEADER)) incr = 4; + else if (bmi->bmiHeader.biSize == sizeof(BITMAPCOREHEADER)) incr = 3; + else { + WARN_(resource)("Wrong bitmap header size!\n"); + return; + } + colors = bmi->bmiHeader.biClrUsed; + if (!colors && (bmi->bmiHeader.biBitCount <= 8)) + colors = 1 << bmi->bmiHeader.biBitCount; + c_W = GetSysColor(COLOR_WINDOW); + c_S = GetSysColor(COLOR_3DSHADOW); + c_F = GetSysColor(COLOR_3DFACE); + c_L = GetSysColor(COLOR_3DLIGHT); + if (loadflags & LR_LOADTRANSPARENT) { + switch (bmi->bmiHeader.biBitCount) { + case 1: pix = pix >> 7; break; + case 4: pix = pix >> 4; break; + case 8: break; + default: + WARN_(resource)("(%d): Unsupported depth\n", bmi->bmiHeader.biBitCount); + return; + } + if (pix >= colors) { + WARN_(resource)("pixel has color index greater than biClrUsed!\n"); + return; + } + if (loadflags & LR_LOADMAP3DCOLORS) c_W = c_F; + ptr = (RGBQUAD*)((char*)bmi->bmiColors+pix*incr); + ptr->rgbBlue = GetBValue(c_W); + ptr->rgbGreen = GetGValue(c_W); + ptr->rgbRed = GetRValue(c_W); + } + if (loadflags & LR_LOADMAP3DCOLORS) + for (i=0; ibmiColors+i*incr); + c_C = RGB(ptr->rgbRed, ptr->rgbGreen, ptr->rgbBlue); + if (c_C == RGB(128, 128, 128)) { + ptr->rgbRed = GetRValue(c_S); + ptr->rgbGreen = GetGValue(c_S); + ptr->rgbBlue = GetBValue(c_S); + } else if (c_C == RGB(192, 192, 192)) { + ptr->rgbRed = GetRValue(c_F); + ptr->rgbGreen = GetGValue(c_F); + ptr->rgbBlue = GetBValue(c_F); + } else if (c_C == RGB(223, 223, 223)) { + ptr->rgbRed = GetRValue(c_L); + ptr->rgbGreen = GetGValue(c_L); + ptr->rgbBlue = GetBValue(c_L); + } + } +} + + /********************************************************************** * BITMAP_Load */