Commit 23ac1c6e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiBitBlt for BitBlt.

parent 8b5ae114
...@@ -569,12 +569,11 @@ BOOL WINAPI NtGdiPatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWOR ...@@ -569,12 +569,11 @@ BOOL WINAPI NtGdiPatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWOR
/*********************************************************************** /***********************************************************************
* BitBlt (GDI32.@) * BitBlt (GDI32.@)
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, BOOL WINAPI NtGdiBitBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height,
INT height, HDC hdcSrc, INT xSrc, INT ySrc, DWORD rop ) 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 ); return NtGdiStretchBlt( hdc_dst, x_dst, y_dst, width, height,
else return StretchBlt( hdcDst, xDst, yDst, width, height, hdc_src, x_src, y_src, width, height, rop, bk_color );
hdcSrc, xSrc, ySrc, width, height, rop );
} }
......
...@@ -215,15 +215,19 @@ static inline BOOL rop_uses_src( DWORD rop ) ...@@ -215,15 +215,19 @@ static inline BOOL rop_uses_src( DWORD rop )
return ((rop >> 2) & 0x330000) != (rop & 0x330000); 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, 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, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
DWORD rop ) DWORD rop )
{ {
if (!rop_uses_src( rop )) return EMFDC_PatBlt( dc_attr, x_dst, y_dst, width_dst, height_dst, 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, return emfdrv_stretchblt( dc_attr->emf, x_dst, y_dst, width_dst, height_dst,
hdc_src, x_src, y_src, width_src, hdc_src, x_src, y_src, width_src,
height_src, rop, EMR_STRETCHBLT ); height_src, rop, EMR_STRETCHBLT );
......
...@@ -48,6 +48,8 @@ static inline BOOL is_meta_dc( HDC hdc ) ...@@ -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, extern BOOL METADC_Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; 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, extern BOOL METADC_Chord( HDC hdc, INT left, INT top, INT right, INT bottom, INT xstart,
INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom ) 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, ...@@ -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 bottom, INT xstart, INT ystart, INT xend,
INT yend, DWORD type ) DECLSPEC_HIDDEN; INT yend, DWORD type ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_BeginPath( DC_ATTR *dc_attr ) 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_CloseFigure( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right, extern BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right,
INT bottom ) DECLSPEC_HIDDEN; INT bottom ) DECLSPEC_HIDDEN;
......
...@@ -1196,6 +1196,24 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop ...@@ -1196,6 +1196,24 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD 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.@) * StretchBlt (GDI32.@)
*/ */
BOOL WINAPI StretchBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst, BOOL WINAPI StretchBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
......
...@@ -37,10 +37,11 @@ BOOL METADC_PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop ...@@ -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, 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, 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 ) }}; BITMAPINFO src_info = {{ sizeof( src_info.bmiHeader ) }};
UINT bmi_size, size, bpp; UINT bmi_size, size, bpp;
int i = 0, bitmap_offset;
BITMAPINFO *bmi; BITMAPINFO *bmi;
METARECORD *mr; METARECORD *mr;
HBITMAP bitmap; HBITMAP bitmap;
...@@ -57,11 +58,12 @@ static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT ...@@ -57,11 +58,12 @@ static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT
else else
bmi_size = sizeof(BITMAPINFOHEADER); 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; src_info.bmiHeader.biSizeImage;
if (!(mr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE; if (!(mr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
mr->rdFunction = META_DIBSTRETCHBLT; mr->rdFunction = type;
bmi = (BITMAPINFO *)&mr->rdParm[10]; bmi = (BITMAPINFO *)&mr->rdParm[bitmap_offset];
bmi->bmiHeader = src_info.bmiHeader; bmi->bmiHeader = src_info.bmiHeader;
TRACE( "size = %u rop=%x\n", size, rop ); 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 ...@@ -70,16 +72,19 @@ static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT
if (ret) if (ret)
{ {
mr->rdSize = size / sizeof(WORD); mr->rdSize = size / sizeof(WORD);
mr->rdParm[0] = LOWORD(rop); mr->rdParm[i++] = LOWORD(rop);
mr->rdParm[1] = HIWORD(rop); mr->rdParm[i++] = HIWORD(rop);
mr->rdParm[2] = height_src; if (bitmap_offset > 8)
mr->rdParm[3] = width_src; {
mr->rdParm[4] = y_src; mr->rdParm[i++] = height_src;
mr->rdParm[5] = x_src; mr->rdParm[i++] = width_src;
mr->rdParm[6] = height_dst; }
mr->rdParm[7] = width_dst; mr->rdParm[i++] = y_src;
mr->rdParm[8] = y_dst; mr->rdParm[i++] = x_src;
mr->rdParm[9] = x_dst; 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 ); 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 ...@@ -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 * METADC_StretchBlt
*/ */
...@@ -96,7 +108,7 @@ BOOL METADC_StretchBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width_dst, INT he ...@@ -96,7 +108,7 @@ BOOL METADC_StretchBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width_dst, INT he
DWORD rop ) DWORD rop )
{ {
return metadc_stretchblt( hdc_dst, x_dst, y_dst, width_dst, height_dst, 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 );
} }
/*********************************************************************** /***********************************************************************
......
...@@ -150,6 +150,8 @@ BOOL WINAPI NtGdiAngleArc( HDC hdc, INT x, INT y, DWORD radius, FLOAT start_ ...@@ -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, BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ); INT xstart, INT ystart, INT xend, INT yend );
BOOL WINAPI NtGdiBeginPath( HDC hdc ); 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 NtGdiCancelDC( HDC hdc );
BOOL WINAPI NtGdiCloseFigure( HDC hdc ); BOOL WINAPI NtGdiCloseFigure( HDC hdc );
INT WINAPI NtGdiCombineRgn( HRGN dest, HRGN src1, HRGN src2, INT mode ); INT WINAPI NtGdiCombineRgn( HRGN dest, HRGN src1, HRGN src2, INT mode );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment