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

Jacek Caban jacek at codeweavers.com
Tue Oct 5 10:40:22 CDT 2021


On 10/5/21 3:47 AM, Jinoh Kang wrote:
> On 10/5/21 02:17, Jacek Caban wrote:
>> 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.
> Since EMF DC has to serialize the entire BITMAPINFO complete with the colour table, perhaps we should just use bitmapinfo_from_user_bitmapinfo instead. This will make EMFDC_StretchDIBits consistent with NtGdiStretchDIBitsInternal. Ditto for EMFDC_SetDIBitsToDevice (NtGdiSetDIBitsToDeviceInternal).


Did you check that it does that on Windows? Another possibility is that 
it could record an incomplete color table and let 
NtGdiStretchDIBitsInternal fill it during replay, so a test showing the 
exact behaviour would be nice.


> That said, there seems to be many other places that directly receive BITMAPINFO from user as well (e.g. metadc.c).
>
> IMHO it would be a good idea to just make the bitmapinfo{,header}_from_user_bitmapinfo function (dib.c) extern, and use it appropriately in future patches. Are you open to this option?


Yes, if we need such helper it would be nice to share it with metadc.c, 
but it's not possible to do that from dib.c, which is in Unix lib now. 
We will need a copy of it on PE side.


Thanks,

Jacek




More information about the wine-devel mailing list