Commit f5f3426c authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Fallback to normal icon drawing if AlphaBlend fails.

parent 7e23f9ce
......@@ -2030,11 +2030,11 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
r.right = cxWidth;
r.bottom = cxWidth;
if (!(hdc_dest = CreateCompatibleDC(hdc))) goto done;
if (!(hdc_dest = CreateCompatibleDC(hdc))) goto failed;
if (!(hB_off = CreateCompatibleBitmap(hdc, cxWidth, cyWidth)))
{
DeleteDC( hdc_dest );
goto done;
goto failed;
}
SelectObject(hdc_dest, hB_off);
FillRect(hdc_dest, &r, hbr);
......@@ -2052,7 +2052,16 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
oldFg = SetTextColor( hdc, RGB(0,0,0) );
oldBg = SetBkColor( hdc, RGB(255,255,255) );
if ((flags & DI_MASK) && (!ptr->alpha || !(flags & DI_IMAGE)))
if (ptr->alpha && (flags & DI_IMAGE))
{
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)
{
SelectObject( hMemDC, ptr->mask );
StretchBlt( hdc_dest, x, y, cxWidth, cyWidth,
......@@ -2061,15 +2070,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
if (flags & DI_IMAGE)
{
if (ptr->alpha)
{
BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
SelectObject( hMemDC, ptr->alpha );
GdiAlphaBlend( hdc_dest, x, y, cxWidth, cyWidth, hMemDC,
0, 0, ptr->width, ptr->height, pixelblend );
}
else if (ptr->color)
if (ptr->color)
{
DWORD rop = (flags & DI_MASK) ? SRCINVERT : SRCCOPY;
SelectObject( hMemDC, ptr->color );
......@@ -2085,6 +2086,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
}
}
done:
if (DoOffscreen) BitBlt( hdc, x0, y0, cxWidth, cyWidth, hdc_dest, 0, 0, SRCCOPY );
SetTextColor( hdc, oldFg );
......@@ -2093,7 +2095,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
result = TRUE;
if (hdc_dest != hdc) DeleteDC( hdc_dest );
if (hB_off) DeleteObject(hB_off);
done:
failed:
DeleteDC( hMemDC );
release_icon_ptr( hIcon, ptr );
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment