gdi32: Use NtGdiBitBlt for BitBlt.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-08-12 12:00:25 +02:00 committed by Alexandre Julliard
parent 8b5ae11421
commit 23ac1c6e62
6 changed files with 63 additions and 24 deletions

View File

@ -569,12 +569,11 @@ BOOL WINAPI NtGdiPatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWOR
/***********************************************************************
* BitBlt (GDI32.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
INT height, HDC hdcSrc, INT xSrc, INT ySrc, DWORD rop )
BOOL WINAPI NtGdiBitBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height,
HDC hdc_src, INT x_src, INT y_src, DWORD rop, DWORD bk_color, FLONG fl )
{
if (!rop_uses_src( rop )) return PatBlt( hdcDst, xDst, yDst, width, height, rop );
else return StretchBlt( hdcDst, xDst, yDst, width, height,
hdcSrc, xSrc, ySrc, width, height, rop );
return NtGdiStretchBlt( hdc_dst, x_dst, y_dst, width, height,
hdc_src, x_src, y_src, width, height, rop, bk_color );
}

View File

@ -215,15 +215,19 @@ static inline BOOL rop_uses_src( DWORD rop )
return ((rop >> 2) & 0x330000) != (rop & 0x330000);
}
BOOL EMFDC_BitBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width, INT height,
HDC hdc_src, INT x_src, INT y_src, DWORD rop )
{
if (!rop_uses_src( rop )) return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width, height, rop );
return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width, height,
hdc_src, x_src, y_src, width, height, rop, EMR_BITBLT );
}
BOOL EMFDC_StretchBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
DWORD rop )
{
if (!rop_uses_src( rop )) return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width_dst, height_dst, rop );
if (width_src == width_dst && height_src == height_dst)
return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst,
hdc_src, x_src, y_src, width_src,
height_src, rop, EMR_BITBLT );
return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst,
hdc_src, x_src, y_src, width_src,
height_src, rop, EMR_STRETCHBLT );

View File

@ -48,6 +48,8 @@ static inline BOOL is_meta_dc( HDC hdc )
extern BOOL METADC_Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL METADC_BitBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height,
HDC hdc_src, INT x_src, INT y_src, DWORD rop );
extern BOOL METADC_Chord( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart,
INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
@ -116,6 +118,8 @@ extern BOOL EMFDC_ArcChordPie( DC_ATTR *dc_attr, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend,
INT yend, DWORD type ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_BeginPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_BitBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width, INT height,
HDC hdc_src, INT x_src, INT y_src, DWORD rop );
extern BOOL EMFDC_CloseFigure( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right,
INT bottom ) DECLSPEC_HIDDEN;

View File

@ -1195,6 +1195,24 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop
return NtGdiPatBlt( hdc, left, top, width, height, rop );
}
/***********************************************************************
* BitBlt (GDI32.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH BitBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height,
HDC hdc_src, INT x_src, INT y_src, DWORD rop )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc_dst )) return METADC_BitBlt( hdc_dst, x_dst, y_dst, width, height,
hdc_src, x_src, y_src, rop );
if (!(dc_attr = get_dc_attr( hdc_dst ))) return FALSE;
if (dc_attr->emf && !EMFDC_BitBlt( dc_attr, x_dst, y_dst, width, height,
hdc_src, x_src, y_src, rop ))
return FALSE;
return NtGdiBitBlt( hdc_dst, x_dst, y_dst, width, height,
hdc_src, x_src, y_src, rop, 0 /* FIXME */, 0 /* FIXME */ );
}
/***********************************************************************
* StretchBlt (GDI32.@)
*/

View File

@ -37,10 +37,11 @@ BOOL METADC_PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop
static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
DWORD rop )
DWORD rop, WORD type )
{
BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }};
UINT bmi_size, size, bpp;
int i = 0, bitmap_offset;
BITMAPINFO *bmi;
METARECORD *mr;
HBITMAP bitmap;
@ -57,11 +58,12 @@ static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT
else
bmi_size = sizeof(BITMAPINFOHEADER);
size = FIELD_OFFSET( METARECORD, rdParm[10] ) + bmi_size +
bitmap_offset = type == META_DIBBITBLT ? 8 : 10;
size = FIELD_OFFSET( METARECORD, rdParm[bitmap_offset] ) + bmi_size +
src_info.bmiHeader.biSizeImage;
if (!(mr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
mr->rdFunction = META_DIBSTRETCHBLT;
bmi = (BITMAPINFO *)&mr->rdParm[10];
mr->rdFunction = type;
bmi = (BITMAPINFO *)&mr->rdParm[bitmap_offset];
bmi->bmiHeader = src_info.bmiHeader;
TRACE( "size = %u rop=%x\n", size, rop );
@ -70,16 +72,19 @@ static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT
if (ret)
{
mr->rdSize = size / sizeof(WORD);
mr->rdParm[0] = LOWORD(rop);
mr->rdParm[1] = HIWORD(rop);
mr->rdParm[2] = height_src;
mr->rdParm[3] = width_src;
mr->rdParm[4] = y_src;
mr->rdParm[5] = x_src;
mr->rdParm[6] = height_dst;
mr->rdParm[7] = width_dst;
mr->rdParm[8] = y_dst;
mr->rdParm[9] = x_dst;
mr->rdParm[i++] = LOWORD(rop);
mr->rdParm[i++] = HIWORD(rop);
if (bitmap_offset > 8)
{
mr->rdParm[i++] = height_src;
mr->rdParm[i++] = width_src;
}
mr->rdParm[i++] = y_src;
mr->rdParm[i++] = x_src;
mr->rdParm[i++] = height_dst;
mr->rdParm[i++] = width_dst;
mr->rdParm[i++] = y_dst;
mr->rdParm[i++] = x_dst;
ret = metadc_record( hdc, mr, size );
}
@ -88,6 +93,13 @@ static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT
}
BOOL METADC_BitBlt( HDC hdc, INT x_dst, INT y_dst, INT width, INT height,
HDC hdc_src, INT x_src, INT y_src, DWORD rop )
{
return metadc_stretchblt( hdc, x_dst, y_dst, width, height,
hdc_src, x_src, y_src, width, height, rop, META_DIBBITBLT );
}
/***********************************************************************
* METADC_StretchBlt
*/
@ -96,7 +108,7 @@ BOOL METADC_StretchBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width_dst, INT he
DWORD rop )
{
return metadc_stretchblt( hdc_dst, x_dst, y_dst, width_dst, height_dst,
hdc_src, x_src, y_src, width_src, height_src, rop );
hdc_src, x_src, y_src, width_src, height_src, rop, META_DIBSTRETCHBLT );
}
/***********************************************************************

View File

@ -150,6 +150,8 @@ BOOL WINAPI NtGdiAngleArc( HDC hdc, INT x, INT y, DWORD radius, FLOAT start_
BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend );
BOOL WINAPI NtGdiBeginPath( HDC hdc );
BOOL WINAPI NtGdiBitBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height, HDC hdc_src,
INT x_src, INT y_src, DWORD rop, DWORD bk_color, FLONG fl );
BOOL WINAPI NtGdiCancelDC( HDC hdc );
BOOL WINAPI NtGdiCloseFigure( HDC hdc );
INT WINAPI NtGdiCombineRgn( HRGN dest, HRGN src1, HRGN src2, INT mode );