From 474f9ff1fa2ebf4ae6c4ef3b0d4987062b30d838 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 12 Jul 2017 11:43:50 +0200 Subject: [PATCH] gdi32: Avoid having the source alpha channel interfere with color comparisons in GdiTransparentBlt. Signed-off-by: Alexandre Julliard --- dlls/gdi32/bitblt.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index 3d8c128fd70..1b057f729de 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -857,7 +857,19 @@ BOOL WINAPI GdiTransparentBlt( HDC hdcDest, int xDest, int yDest, int widthDest, if(oldStretchMode == BLACKONWHITE || oldStretchMode == WHITEONBLACK) SetStretchBltMode(hdcSrc, COLORONCOLOR); hdcWork = CreateCompatibleDC(hdcDest); - bmpWork = CreateCompatibleBitmap(hdcDest, widthDest, heightDest); + if (GetObjectType( hdcDest ) != OBJ_MEMDC && GetDeviceCaps( hdcDest, BITSPIXEL ) == 32) + { + /* screen DCs are not supposed to have an alpha channel, so use a 24-bpp bitmap as copy */ + BITMAPINFO info; + info.bmiHeader.biSize = sizeof(info.bmiHeader); + info.bmiHeader.biWidth = widthDest; + info.bmiHeader.biHeight = heightDest; + info.bmiHeader.biPlanes = 1; + info.bmiHeader.biBitCount = 24; + info.bmiHeader.biCompression = BI_RGB; + bmpWork = CreateDIBSection( 0, &info, DIB_RGB_COLORS, NULL, NULL, 0 ); + } + else bmpWork = CreateCompatibleBitmap(hdcDest, widthDest, heightDest); oldWork = SelectObject(hdcWork, bmpWork); if(!StretchBlt(hdcWork, 0, 0, widthDest, heightDest, hdcSrc, xSrc, ySrc, widthSrc, heightSrc, SRCCOPY)) { TRACE("Failed to stretch\n"); -- 2.11.4.GIT