Commit eddc4609 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Fix StretchDIBits color mapping for monochrome bitmaps without a color table.

This is the equivalent of df924f6a for the StretchDIBits case. Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 57f9c33c
...@@ -567,22 +567,33 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he ...@@ -567,22 +567,33 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, rop ); err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, rop );
if (err == ERROR_BAD_FORMAT) if (err == ERROR_BAD_FORMAT)
{ {
DWORD dst_colors = dst_info->bmiHeader.biClrUsed;
/* 1-bpp destination without a color table requires a fake 1-entry table /* 1-bpp destination without a color table requires a fake 1-entry table
* that contains only the background color */ * that contains only the background color; except with a 1-bpp source,
if (dst_info->bmiHeader.biBitCount == 1 && !dst_info->bmiHeader.biClrUsed) * in which case it uses the source colors */
if (dst_info->bmiHeader.biBitCount == 1 && !dst_colors)
{ {
COLORREF color = GetBkColor( dev->hdc ); if (src_info->bmiHeader.biBitCount > 1)
dst_info->bmiColors[0].rgbRed = GetRValue( color ); {
dst_info->bmiColors[0].rgbGreen = GetGValue( color ); COLORREF color = GetBkColor( dev->hdc );
dst_info->bmiColors[0].rgbBlue = GetBValue( color ); dst_info->bmiColors[0].rgbRed = GetRValue( color );
dst_info->bmiColors[0].rgbReserved = 0; dst_info->bmiColors[0].rgbGreen = GetGValue( color );
dst_info->bmiHeader.biClrUsed = 1; dst_info->bmiColors[0].rgbBlue = GetBValue( color );
dst_info->bmiColors[0].rgbReserved = 0;
dst_info->bmiHeader.biClrUsed = 1;
}
else
{
memcpy( dst_info->bmiColors, src_info->bmiColors, 2 * sizeof(dst_info->bmiColors[0]) );
dst_info->bmiHeader.biClrUsed = 2;
}
} }
if (!(err = convert_bits( src_info, &src, dst_info, &src_bits ))) if (!(err = convert_bits( src_info, &src, dst_info, &src_bits )))
{ {
/* get rid of the fake 1-bpp table */ /* get rid of the fake 1-bpp table */
if (dst_info->bmiHeader.biClrUsed == 1) dst_info->bmiHeader.biClrUsed = 0; dst_info->bmiHeader.biClrUsed = dst_colors;
err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, rop ); err = dev->funcs->pPutImage( dev, clip, dst_info, &src_bits, &src, &dst, rop );
} }
} }
......
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