gdi32: Directly handle EMFs in GdiComment.

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-17 11:39:46 +02:00 committed by Alexandre Julliard
parent 6167fd3290
commit 2ef5b9720f
4 changed files with 8 additions and 25 deletions

View File

@ -73,7 +73,6 @@ extern BOOL CDECL EMFDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_GdiComment( PHYSDEV dev, UINT bytes, const BYTE *buffer ) DECLSPEC_HIDDEN;
extern INT CDECL EMFDRV_GetDeviceCaps( PHYSDEV dev, INT cap ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode ) DECLSPEC_HIDDEN;

View File

@ -66,7 +66,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_FlattenPath, /* pFlattenPath */
NULL, /* pFontIsLinked */
EMFDRV_FrameRgn, /* pFrameRgn */
EMFDRV_GdiComment, /* pGdiComment */
NULL, /* pGdiComment */
NULL, /* pGetBoundsRect */
NULL, /* pGetCharABCWidths */
NULL, /* pGetCharABCWidthsI */

View File

@ -510,15 +510,18 @@ COLORREF CDECL EMFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color )
return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
}
/******************************************************************
* EMFDRV_GdiComment
/*******************************************************************
* GdiComment (GDI32.@)
*/
BOOL CDECL EMFDRV_GdiComment(PHYSDEV dev, UINT bytes, const BYTE *buffer)
BOOL WINAPI GdiComment( HDC hdc, UINT bytes, const BYTE *buffer )
{
DC_ATTR *dc_attr;
EMRGDICOMMENT *emr;
UINT total, rounded_size;
BOOL ret;
if (!(dc_attr = get_dc_attr( hdc )) || !dc_attr->emf) return FALSE;
rounded_size = (bytes+3) & ~3;
total = offsetof(EMRGDICOMMENT,Data) + rounded_size;
@ -529,7 +532,7 @@ BOOL CDECL EMFDRV_GdiComment(PHYSDEV dev, UINT bytes, const BYTE *buffer)
memset(&emr->Data[bytes], 0, rounded_size - bytes);
memcpy(&emr->Data[0], buffer, bytes);
ret = EMFDRV_WriteRecord( dev, &emr->emr );
ret = EMFDRV_WriteRecord( dc_attr->emf, &emr->emr );
HeapFree(GetProcessHeap(), 0, emr);

View File

@ -1217,25 +1217,6 @@ BOOL WINAPI GetColorAdjustment(HDC hdc, LPCOLORADJUSTMENT lpca)
return FALSE;
}
/*******************************************************************
* GdiComment [GDI32.@]
*
*
*/
BOOL WINAPI GdiComment(HDC hdc, UINT cbSize, const BYTE *lpData)
{
DC *dc = get_dc_ptr(hdc);
BOOL ret = FALSE;
if(dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGdiComment );
ret = physdev->funcs->pGdiComment( physdev, cbSize, lpData );
release_dc_ptr( dc );
}
return ret;
}
/*******************************************************************
* SetColorAdjustment [GDI32.@]
*