Huw Davies <huw@xxxxxxxxxxxxxxx> 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. It's not clear to me that CreateDIBitmap should generate a monochrome bitmap (tests under Windows show that it doesn't), however other areas of Wine rely on this behaviour (in particular the cursor code) and I'm not going to mess with those at the moment. Besides the new StretchDIBits is more symmetric when written this way. -- Huw Davies huw@xxxxxxxxxxxxxxx Index: objects/dib.c =================================================================== RCS file: /home/wine/wine/objects/dib.c,v retrieving revision 1.77 diff -u -r1.77 dib.c --- objects/dib.c 11 Nov 2003 00:27:10 -0000 1.77 +++ objects/dib.c 12 Nov 2003 14:04:00 -0000 @@ -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); - - } else { - hBitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT, - bits, info, wUsage ); - 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, wUsage); /* Origin for DIBitmap may be bottom left (positive biHeight) or top left (negative biHeight) */