mirror of
https://github.com/reactos/wine.git
synced 2025-02-09 13:43:16 +00:00
gdi32: Fix the 8 bpp generated colour table.
This commit is contained in:
parent
163dfd148b
commit
bc653ce204
@ -456,7 +456,7 @@ static const RGBQUAD DefLogPaletteQuads[20] = { /* Copy of Default Logical Palet
|
||||
{ 0xf0, 0xfb, 0xff, 0x00 },
|
||||
{ 0xa4, 0xa0, 0xa0, 0x00 },
|
||||
{ 0x80, 0x80, 0x80, 0x00 },
|
||||
{ 0x00, 0x00, 0xf0, 0x00 },
|
||||
{ 0x00, 0x00, 0xff, 0x00 },
|
||||
{ 0x00, 0xff, 0x00, 0x00 },
|
||||
{ 0x00, 0xff, 0xff, 0x00 },
|
||||
{ 0xff, 0x00, 0x00, 0x00 },
|
||||
@ -639,24 +639,15 @@ INT WINAPI GetDIBits(
|
||||
break;
|
||||
|
||||
case 8:
|
||||
{
|
||||
INT r, g, b;
|
||||
RGBQUAD *color;
|
||||
|
||||
memcpy(rgbQuads, DefLogPaletteQuads, 10 * sizeof(RGBQUAD));
|
||||
memcpy(rgbQuads + 246, DefLogPaletteQuads + 10, 10 * sizeof(RGBQUAD));
|
||||
color = rgbQuads + 10;
|
||||
for(r = 0; r <= 5; r++) /* FIXME */
|
||||
for(g = 0; g <= 5; g++)
|
||||
for(b = 0; b <= 5; b++) {
|
||||
color->rgbRed = (r * 0xff) / 5;
|
||||
color->rgbGreen = (g * 0xff) / 5;
|
||||
color->rgbBlue = (b * 0xff) / 5;
|
||||
color->rgbReserved = 0;
|
||||
color++;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 10; i < 246; i++)
|
||||
{
|
||||
rgbQuads[i].rgbRed = (i & 0x07) << 5;
|
||||
rgbQuads[i].rgbGreen = (i & 0x38) << 2;
|
||||
rgbQuads[i].rgbBlue = i & 0xc0;
|
||||
rgbQuads[i].rgbReserved = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1534,6 +1534,7 @@ static void test_GetDIBits(void)
|
||||
BYTE buf[1024];
|
||||
char bi_buf[sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256];
|
||||
BITMAPINFO *bi = (BITMAPINFO *)bi_buf;
|
||||
PALETTEENTRY pal_ents[32];
|
||||
|
||||
hdc = GetDC(0);
|
||||
|
||||
@ -1722,6 +1723,50 @@ todo_wine
|
||||
for (i = 2; i < 256; i++)
|
||||
ok(((WORD*)bi->bmiColors)[i] == 0xAAAA, "Color %d is %d\n", i, ((WORD*)bi->bmiColors)[i]);
|
||||
|
||||
/* retrieve 8-bit DIB data */
|
||||
memset(bi, 0, sizeof(*bi));
|
||||
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bi->bmiHeader.biWidth = bm.bmWidth;
|
||||
bi->bmiHeader.biHeight = bm.bmHeight;
|
||||
bi->bmiHeader.biPlanes = 1;
|
||||
bi->bmiHeader.biBitCount = 8;
|
||||
bi->bmiHeader.biCompression = BI_RGB;
|
||||
bi->bmiHeader.biSizeImage = 0;
|
||||
memset(bi->bmiColors, 0xAA, sizeof(RGBQUAD) * 256);
|
||||
memset(buf, 0xAA, sizeof(buf));
|
||||
SetLastError(0xdeadbeef);
|
||||
lines = GetDIBits(hdc, hbmp, 0, bm.bmHeight, buf, bi, DIB_RGB_COLORS);
|
||||
ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %u\n",
|
||||
lines, bm.bmHeight, GetLastError());
|
||||
|
||||
GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, 32, pal_ents );
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
RGBQUAD expect;
|
||||
|
||||
if (i < 10 || i >= 246)
|
||||
{
|
||||
int entry = i < 10 ? i : i - 236;
|
||||
expect.rgbRed = pal_ents[entry].peRed;
|
||||
expect.rgbGreen = pal_ents[entry].peGreen;
|
||||
expect.rgbBlue = pal_ents[entry].peBlue;
|
||||
}
|
||||
else
|
||||
{
|
||||
expect.rgbRed = (i & 0x07) << 5;
|
||||
expect.rgbGreen = (i & 0x38) << 2;
|
||||
expect.rgbBlue = i & 0xc0;
|
||||
}
|
||||
expect.rgbReserved = 0;
|
||||
|
||||
ok(!memcmp(bi->bmiColors + i, &expect, sizeof(expect)),
|
||||
"expected bmiColors[%d] %x %x %x %x - got %x %x %x %x\n", i,
|
||||
expect.rgbRed, expect.rgbGreen, expect.rgbBlue, expect.rgbReserved,
|
||||
bi->bmiColors[i].rgbRed, bi->bmiColors[i].rgbGreen,
|
||||
bi->bmiColors[i].rgbBlue, bi->bmiColors[i].rgbReserved);
|
||||
}
|
||||
|
||||
/* retrieve 24-bit DIB data */
|
||||
memset(bi, 0, sizeof(*bi));
|
||||
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
|
Loading…
x
Reference in New Issue
Block a user