[RFC PATCH] gdi32: allow passing BITMAPINFO with bmiHeader.biSizeImage == 0 for EMF DC.

Jacek Caban jacek at codeweavers.com
Mon Oct 4 12:17:38 CDT 2021


Hi Jinoh,

Thanks for looking at it. The patch seems to do the right thing, but 
some aspects are not clear to me.

On 10/3/21 9:04 PM, Jinoh Kang wrote:
> +static UINT get_user_dib_image_size( const BITMAPINFO *info )
> +{
> +    UINT size;
> +
> +    if (info->bmiHeader.biCompression != BI_RGB)
> +    {
> +        /* compressed image -- always trust biSizeImage */
> +        return info->bmiHeader.biSizeImage;
> +    }
> +
> +    size = get_dib_image_size( info );
> +
> +    /* biSizeImage can be zero if biCompression == BI_RGB */
> +    if (info->bmiHeader.biSizeImage)
> +    {
> +        if (info->bmiHeader.biSizeImage < size)
> +            TRACE( "biSizeImage (%u) smaller than calculated size (%u)",
> +                   info->bmiHeader.biSizeImage,
> +                   size );
> +        else
> +            size = info->bmiHeader.biSizeImage; /* FIXME */
> +    }
> +
> +    return size;
> +}


Looking at bitmapinfoheader_from_user_bitmapinfo, we should probably 
ignore biSizeImage for BI_RGB and BI_BITFIELDS. There is also a question 
about what we should use for biSizeImage recorded as part of 
BITMAPINFOHEADER. Maybe we should just copy 
bitmapinfoheader_from_user_bitmapinfo and use it here. Ideally, we'd 
have a test for that in tests/metafile.c.


Thanks,

Jacek




More information about the wine-devel mailing list