From d87715c831de95cd4ba572db275ac2f0e856dfac Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 16 Jun 2010 14:54:37 +0200 Subject: [PATCH] user32: Don't try to alpha blend icons when drawing to a monochrome device. --- dlls/user32/cursoricon.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 0f8d7da2e37..9a1810e22a1 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -2054,11 +2054,21 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon, if (ptr->alpha && (flags & DI_IMAGE)) { - BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; + BOOL is_mono = FALSE; - SelectObject( hMemDC, ptr->alpha ); - if (GdiAlphaBlend( hdc_dest, x, y, cxWidth, cyWidth, hMemDC, - 0, 0, ptr->width, ptr->height, pixelblend )) goto done; + if (GetObjectType( hdc_dest ) == OBJ_MEMDC) + { + BITMAP bm; + HBITMAP bmp = GetCurrentObject( hdc_dest, OBJ_BITMAP ); + is_mono = GetObjectW( bmp, sizeof(bm), &bm ) && bm.bmBitsPixel == 1; + } + if (!is_mono) + { + BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; + SelectObject( hMemDC, ptr->alpha ); + if (GdiAlphaBlend( hdc_dest, x, y, cxWidth, cyWidth, hMemDC, + 0, 0, ptr->width, ptr->height, pixelblend )) goto done; + } } if (flags & DI_MASK) -- 2.11.4.GIT