Alexandre Julliard : user32: Fallback to normal icon drawing if AlphaBlend fails.
Alexandre Julliard
julliard at winehq.org
Mon May 31 11:21:35 CDT 2010
Module: wine
Branch: master
Commit: f5f3426c878238545393ce4e95be2c75217f55ea
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f5f3426c878238545393ce4e95be2c75217f55ea
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat May 29 10:47:28 2010 +0200
user32: Fallback to normal icon drawing if AlphaBlend fails.
---
dlls/user32/cursoricon.c | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index e4973e3..b54d9fd 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -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;
More information about the wine-cvs
mailing list