gdi32: Add a special case for converting dibs to 1-bpp using the background color.

This commit is contained in:
Alexandre Julliard 2011-07-19 20:06:32 +02:00
parent be835e2d9b
commit 07528a24b9
1 changed files with 8 additions and 0 deletions

View File

@ -692,6 +692,14 @@ static DWORD colorref_to_pixel_colortable(const dib_info *dib, COLORREF color)
rgb.rgbGreen = GetGValue(color);
rgb.rgbBlue = GetBValue(color);
/* special case for conversion to 1-bpp without a color table:
* we get a 1-entry table containing the background color
*/
if (dib->bit_count == 1 && dib->color_table_size == 1)
return (rgb.rgbRed == dib->color_table[0].rgbRed &&
rgb.rgbGreen == dib->color_table[0].rgbGreen &&
rgb.rgbBlue == dib->color_table[0].rgbBlue);
for(i = 0; i < dib->color_table_size; i++)
{
RGBQUAD *cur = dib->color_table + i;