uxtheme: Use TransparentBlt() for bitmaps with all alpha values being 0xff.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51553
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 96b7a8a317)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-08-25 14:24:31 +08:00 committed by Michael Stefaniuc
parent f1589ee006
commit 7398ed2977
1 changed files with 9 additions and 2 deletions

View File

@ -1074,11 +1074,18 @@ static BOOL prepare_alpha (HBITMAP bmp, BOOL* hasAlpha)
if (!bmp || GetObjectW( bmp, sizeof(dib), &dib ) != sizeof(dib))
return FALSE;
if(dib.dsBm.bmBitsPixel != 32)
if (dib.dsBm.bmBitsPixel != 32 || dib.dsBmih.biCompression != BI_RGB)
/* nothing to do */
return TRUE;
*hasAlpha = TRUE;
/* If all alpha values are 0xff, don't use alpha blending */
for (n = 0, p = dib.dsBm.bmBits; n < dib.dsBmih.biWidth * dib.dsBmih.biHeight; n++, p += 4)
if ((*hasAlpha = (p[3] != 0xff)))
break;
if (!*hasAlpha)
return TRUE;
p = dib.dsBm.bmBits;
n = dib.dsBmih.biHeight * dib.dsBmih.biWidth;
/* AlphaBlend() wants premultiplied alpha, so do that now */