[PATCH 2/2] comctl32/toolbar: Correctly draw disabled toolbar button which contains 32 bpp bitmap with alpha channel.

Nikolay Sivov nsivov at codeweavers.com
Wed Mar 4 04:04:59 CST 2020


On 3/4/20 12:42 PM, Ziqing Hui wrote:

> +    has_alpha = FALSE;
> +    if (bmp.bmBitsPixel == 32)
> +    {
> +        for (pixel = bits; pixel < bits + cx * cy; pixel++)
> +        {
> +            if ((*pixel >> 24) != 0)
> +            {
> +                has_alpha = TRUE;
> +                break;
> +            }
> +        }
> +    }
> +
> +    if (has_alpha)
> +    {
> +        /* gray the src image */
> +        for (pixel = bits; pixel < bits + cx * cy; pixel++)
> +        {
> +            DWORD alpha = (*pixel >> 24) & 0x000000ff;
> +            DWORD red   = (*pixel >> 16) & 0x000000ff;
> +            DWORD green = (*pixel >> 8)  & 0x000000ff;
> +            DWORD blue  = (*pixel)       & 0x000000ff;
> +            DWORD gray = (red * 299 + green * 587 + blue * 114) / 1000;
> +            gray = gray * alpha / 0xff;
> +            *pixel = ((alpha << 24) | (gray << 16) | (gray << 8) | gray);
> +        }
> +        bf.BlendOp = AC_SRC_OVER;
> +        bf.BlendFlags = 0;
> +        bf.SourceConstantAlpha = 0xff;
> +        bf.AlphaFormat = AC_SRC_ALPHA;
> +        GdiAlphaBlend(hdc, x, y, cx, cy, hdcImage, 0, 0, cx, cy, bf);
> +        goto done;
> +    }
> +
I think it's possible ILS_SATURATE should be used for that. Have you 
checked rendering on Windows with this flag?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200304/740a3ed7/attachment.htm>


More information about the wine-devel mailing list