DIB_FixColorsToLoadflags: Support bitmaps with a BITMAPCOREHEADER
properly
Michael Kaufmann
hallo at michael-kaufmann.ch
Sun Sep 26 09:57:25 CDT 2004
Changelog:
- DIB_FixColorsToLoadflags: Support bitmaps with a BITMAPCOREHEADER
properly
-------------- next part --------------
Index: windows/cursoricon.c
===================================================================
RCS file: /home/wine/wine/windows/cursoricon.c,v
retrieving revision 1.75
diff -u -r1.75 cursoricon.c
--- windows/cursoricon.c 20 Sep 2004 21:45:00 -0000 1.75
+++ windows/cursoricon.c 26 Sep 2004 12:59:20 -0000
@@ -773,7 +773,7 @@
bmi->bmiHeader.biBitCount ) * abs( bmi->bmiHeader.biHeight ) / 2;
pInfo->bmiHeader.biBitCount = 1;
- if (pInfo->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
+ if (pInfo->bmiHeader.biSize != sizeof(BITMAPCOREHEADER))
{
RGBQUAD *rgb = pInfo->bmiColors;
@@ -2010,28 +2010,44 @@
COLORREF c_W, c_S, c_F, c_L, c_C;
int incr,i;
RGBQUAD *ptr;
+ int bitmap_type;
+ LONG width;
+ LONG height;
+ WORD bpp;
+ DWORD compr;
+
+ if (((bitmap_type = DIB_GetBitmapInfo((BITMAPINFOHEADER*) bmi, &width, &height, &bpp, &compr)) == -1))
+ {
+ WARN_(resource)("Invalid bitmap\n");
+ return;
+ }
- 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;
+ if (bpp > 8) return;
+
+ if (bitmap_type == 0) /* BITMAPCOREHEADER */
+ {
+ incr = 3;
+ colors = 1 << bpp;
+ }
+ else
+ {
+ incr = 4;
+ colors = bmi->bmiHeader.biClrUsed;
+ if (!colors && (bpp <= 8)) colors = 1 << bpp;
}
- 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) {
+ switch (bpp) {
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);
+ WARN_(resource)("(%d): Unsupported depth\n", bpp);
return;
}
if (pix >= colors) {
More information about the wine-patches
mailing list