[PATCH] user32: Create a mask from alpha channel when loading a 32 bpp icon. (v3)

Alexandre Julliard julliard at winehq.org
Mon Aug 20 11:21:27 CDT 2018


Dmitry Timoshkov <dmitry at baikal.ru> writes:

> diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
> index 0adb73bf56..5d63a42373 100644
> --- a/dlls/user32/cursoricon.c
> +++ b/dlls/user32/cursoricon.c
> @@ -1296,6 +1296,41 @@ static HICON create_icon_from_bmi( const BITMAPINFO *bmi, DWORD maxsize, HMODULE
>                         0, 0, bmi_width, bmi_height,
>                         mask_bits, bmi_copy, DIB_RGB_COLORS, SRCCOPY );
>      }
> +    else
> +    {
> +        if (bmi_has_alpha( bmi, color_bits ))
> +        {
> +            DWORD alpha_mask_bits_size = bmi_width * bmi_height;
> +            unsigned char *alpha_mask_bits = HeapAlloc( GetProcessHeap(), 0, alpha_mask_bits_size );

Rows need to be 32-bit aligned. I expect it would also cause less code
duplication to directly create a 1-bpp bitmap.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list