[PATCH 1/7] gdi32: Use GetDIBits in emfdrv_stretchblt.
Jacek Caban
jacek at codeweavers.com
Wed Aug 11 07:33:48 CDT 2021
On 8/11/21 12:11 PM, Huw Davies wrote:
> On Wed, Aug 11, 2021 at 10:57:56AM +0200, Jacek Caban wrote:
>> /* Generate an EMRBITBLT, EMRSTRETCHBLT or EMRALPHABLEND record depending on the type parameter */
>> -static BOOL emfdrv_stretchblt( PHYSDEV dev_dst, struct bitblt_coords *dst, PHYSDEV dev_src,
>> +static BOOL emfdrv_stretchblt( PHYSDEV dev_dst, struct bitblt_coords *dst, HDC hdc_src,
>> struct bitblt_coords *src, DWORD rop, DWORD type )
>> {
>> - unsigned char src_buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])];
>> - BITMAPINFO *src_info = (BITMAPINFO *)src_buffer;
>> - UINT bits_size, bmi_size, emr_size, size, bpp;
>> - EMRSTRETCHBLT *emr_stretchblt;
>> - struct gdi_image_bits bits;
>> + BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }};
>> + UINT bmi_size, emr_size, size, bpp;
>> BITMAPINFO *bmi;
>> EMRBITBLT *emr;
>> - DC *dc_src;
>> - DWORD err;
>> - BOOL ret = FALSE;
>> -
>> - dc_src = get_physdev_dc(dev_src);
>> - dev_src = GET_DC_PHYSDEV(dc_src, pGetImage);
>> - err = dev_src->funcs->pGetImage(dev_src, src_info, &bits, src);
>> - if (err)
>> - {
>> - SetLastError(err);
>> - return FALSE;
>> - }
>> + HBITMAP bitmap;
>> + BOOL ret;
>>
>> - bpp = src_info->bmiHeader.biBitCount;
>> + if (!(bitmap = GetCurrentObject( hdc_src, OBJ_BITMAP ))) return FALSE;
>> + if (!GetDIBits( hdc_src, bitmap, 0, INT_MAX, NULL, &src_info, DIB_RGB_COLORS )) return FALSE;
> What about a blit from a screen dc to the metafile?
I just tested it and they indeed should be supported by EMFs (they are,
however, not supported by old-style metafiles). I guess we will need an
additional blit into a temporary DC for that.
Thanks,
Jacek
More information about the wine-devel
mailing list