Commit baceb8d0 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Return bitmask for 32-bit bitmaps too in GetDIBits.

parent 22d2abba
......@@ -640,19 +640,17 @@ INT WINAPI GetDIBits(
DIB_GetDIBImageBytes( bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight,
bmp->bitmap.bmBitsPixel );
info->bmiHeader.biCompression = (bmp->bitmap.bmBitsPixel > 8) ? BI_BITFIELDS : BI_RGB;
switch(bmp->bitmap.bmBitsPixel)
{
case 15:
info->bmiHeader.biBitCount = 16;
info->bmiHeader.biCompression = BI_RGB;
break;
case 16:
info->bmiHeader.biBitCount = 16;
info->bmiHeader.biCompression = BI_BITFIELDS;
case 24:
info->bmiHeader.biBitCount = 32;
break;
default:
info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
info->bmiHeader.biCompression = BI_RGB;
break;
}
info->bmiHeader.biXPelsPerMeter = 0;
......@@ -824,6 +822,16 @@ INT WINAPI GetDIBits(
((PDWORD)info->bmiColors)[2] = 0x001f;
}
break;
case 24:
case 32:
if (info->bmiHeader.biCompression == BI_BITFIELDS)
{
((PDWORD)info->bmiColors)[0] = 0xff0000;
((PDWORD)info->bmiColors)[1] = 0x00ff00;
((PDWORD)info->bmiColors)[2] = 0x0000ff;
}
break;
}
if (bits && lines)
......
......@@ -1623,11 +1623,13 @@ static void test_GetDIBits_BI_BITFIELDS(void)
/* Call GetDIBits to fill in bmiHeader. */
ret = GetDIBits(hdc, hbm, 0, 1, NULL, dibinfo, DIB_RGB_COLORS);
ok(ret == 1, "GetDIBits failed\n");
if (dibinfo->bmiHeader.biBitCount == 16 &&
dibinfo->bmiHeader.biCompression == BI_BITFIELDS)
if (dibinfo->bmiHeader.biBitCount > 8)
{
DWORD *bitmasks = (DWORD *)dibinfo->bmiColors;
ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS,
"compression is %u\n", dibinfo->bmiHeader.biCompression );
ok( !bitmasks[0], "red mask is set\n" );
ok( !bitmasks[1], "green mask is set\n" );
ok( !bitmasks[2], "blue mask is set\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment