Alexandre Julliard : user32: Don' t try to alpha blend icons when drawing to a monochrome device.
Module: wine Branch: master Commit: d87715c831de95cd4ba572db275ac2f0e856dfac URL: http://source.winehq.org/git/wine.git/?a=commit;h=d87715c831de95cd4ba572db27... Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 16 14:54:37 2010 +0200 user32: Don't try to alpha blend icons when drawing to a monochrome device. --- dlls/user32/cursoricon.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 0f8d7da..9a1810e 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)
participants (1)
-
Alexandre Julliard