user32: Don't try to alpha blend icons when drawing to a monochrome device.

This commit is contained in:
Alexandre Julliard 2010-06-16 14:54:37 +02:00
parent cdf6947080
commit d87715c831
1 changed files with 14 additions and 4 deletions

View File

@ -2054,11 +2054,21 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
if (ptr->alpha && (flags & DI_IMAGE)) 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 (GetObjectType( hdc_dest ) == OBJ_MEMDC)
if (GdiAlphaBlend( hdc_dest, x, y, cxWidth, cyWidth, hMemDC, {
0, 0, ptr->width, ptr->height, pixelblend )) goto done; 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) if (flags & DI_MASK)