Make sure we create a polychrome bitmap from the dib. CreateDIBitmap
doesn't do this when the dib is 1bpp and has a black/white colour
table. In such cases this resulted in a monochrome bitmap being
StretchBlt'ed which is clearly incorrect since we then start using
text and bkgnd colours.
diff --git a/objects/dib.c b/objects/dib.c
index 5df8c8a..7f3127f 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -164,7 +164,7 @@
dc = DC_GetDCUpdate( hdc );
if(!dc) return FALSE;
-
+
if(dc->funcs->pStretchDIBits)
{
heightSrc = dc->funcs->pStretchDIBits(dc->physDev, xDst, yDst, widthDst,
@@ -179,6 +179,10 @@
GDI_ReleaseObj( hdc );
hdcMem = CreateCompatibleDC( hdc );
+ hBitmap = CreateCompatibleBitmap(hdc, info->bmiHeader.biWidth,
+ info->bmiHeader.biHeight);
+ hOldBitmap = SelectObject( hdcMem, hBitmap );
+
if (info->bmiHeader.biCompression == BI_RLE4 ||
info->bmiHeader.biCompression == BI_RLE8) {
@@ -196,22 +200,15 @@
* pStretchDIBits function shall be implemented.
* ericP (2000/09/09)
*/
- hBitmap = CreateCompatibleBitmap(hdc, info->bmiHeader.biWidth,
- info->bmiHeader.biHeight);
- hOldBitmap = SelectObject( hdcMem, hBitmap );
- /* copy existing bitmap from destination dc */
- StretchBlt( hdcMem, xSrc, abs(info->bmiHeader.biHeight) - heightSrc - ySrc,
- widthSrc, heightSrc, hdc, xDst, yDst, widthDst, heightDst,
- dwRop );
- SetDIBits(hdcMem, hBitmap, 0, info->bmiHeader.biHeight, bits,
- info, DIB_RGB_COLORS);
+ /* copy existing bitmap from destination dc */
+ StretchBlt( hdcMem, xSrc, abs(info->bmiHeader.biHeight) - heightSrc - ySrc,
+ widthSrc, heightSrc, hdc, xDst, yDst, widthDst, heightDst,
+ dwRop );
+ }
- } else {
- hBitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT,
- bits, info, wUsage );
- hOldBitmap = SelectObject( hdcMem, hBitmap );
- }
+ SetDIBits(hdcMem, hBitmap, 0, info->bmiHeader.biHeight, bits,
+ info, wUsage);
/* Origin for DIBitmap may be bottom left (positive biHeight) or top
left (negative biHeight) */