gdi32: Handle metafiles directly in SetWindowExtEx.

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-10 07:37:42 +01:00 committed by Alexandre Julliard
parent 16eaffff06
commit 1cbd3307f7
9 changed files with 27 additions and 48 deletions

View File

@ -231,23 +231,15 @@ BOOL EMFDC_SetViewportExtEx( DC_ATTR *dc_attr, INT cx, INT cy )
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL CDECL EMFDRV_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
BOOL EMFDC_SetWindowExtEx( DC_ATTR *dc_attr, INT cx, INT cy )
{
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetWindowExtEx );
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
EMRSETWINDOWEXTEX emr;
BOOL ret;
emr.emr.iType = EMR_SETWINDOWEXTEX;
emr.emr.nSize = sizeof(emr);
emr.szlExtent.cx = cx;
emr.szlExtent.cy = cy;
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
physDev->modifying_transform++;
ret = next->funcs->pSetWindowExtEx( next, cx, cy, size );
physDev->modifying_transform--;
return ret;
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL EMFDC_SetViewportOrgEx( DC_ATTR *dc_attr, INT x, INT y )

View File

@ -110,7 +110,6 @@ extern INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDes
BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_StretchBlt( PHYSDEV devDst, struct bitblt_coords *dst,

View File

@ -131,7 +131,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_SetTextColor, /* pSetTextColor */
NULL, /* pSetViewportExtEx */
NULL, /* pSetViewportOrgEx */
EMFDRV_SetWindowExtEx, /* pSetWindowExtEx */
NULL, /* pSetWindowExtEx */
EMFDRV_SetWindowOrgEx, /* pSetWindowOrgEx */
EMFDRV_SetWorldTransform, /* pSetWorldTransform */
NULL, /* pStartDoc */

View File

@ -100,6 +100,7 @@ extern BOOL METADC_SetTextAlign( HDC hdc, UINT align ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextJustification( HDC hdc, INT extra, INT breaks ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetViewportExtEx( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetViewportOrgEx( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetWindowExtEx( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
/* enhanced metafiles */
extern BOOL EMFDC_AbortPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
@ -168,5 +169,6 @@ extern BOOL EMFDC_SetTextAlign( DC_ATTR *dc_attr, UINT align ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetTextJustification( DC_ATTR *dc_attr, INT extra, INT breaks ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetViewportExtEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetViewportOrgEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetWindowExtEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
#endif /* __WINE_GDI_PRIVATE_H */

View File

@ -454,6 +454,25 @@ BOOL WINAPI GetWindowExtEx( HDC hdc, SIZE *size )
return TRUE;
}
/***********************************************************************
* SetWindowExtEx (GDI32.@)
*/
BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, SIZE *size )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc )) return METADC_SetWindowExtEx( hdc, x, y );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_SetWindowExtEx( dc_attr, x, y )) return FALSE;
if (size) *size = dc_attr->wnd_ext;
if (dc_attr->map_mode != MM_ISOTROPIC && dc_attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!x || !y) return FALSE;
dc_attr->wnd_ext.cx = x;
dc_attr->wnd_ext.cy = y;
return NtGdiComputeXformCoefficients( hdc );
}
/***********************************************************************
* GetWindowOrgEx (GDI32.@)
*/

View File

@ -182,20 +182,6 @@ BOOL CDECL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
{
DC *dc = get_nulldrv_dc( dev );
if (size)
*size = dc->attr->wnd_ext;
if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!cx || !cy) return FALSE;
dc->attr->wnd_ext.cx = cx;
dc->attr->wnd_ext.cy = cy;
/* The API docs say that you should call SetWindowExtEx before
SetViewportExtEx. This advice does not imply that Windows
doesn't ensure the isotropic mapping after SetWindowExtEx! */
if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
}
@ -365,24 +351,6 @@ BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc )
}
/***********************************************************************
* SetWindowExtEx (GDI32.@)
*/
BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, LPSIZE size )
{
BOOL ret = FALSE;
DC * dc = get_dc_ptr( hdc );
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetWindowExtEx );
ret = physdev->funcs->pSetWindowExtEx( physdev, x, y, size );
release_dc_ptr( dc );
}
return ret;
}
/***********************************************************************
* SetWindowOrgEx (GDI32.@)
*/

View File

@ -105,9 +105,9 @@ BOOL METADC_SetViewportOrgEx( HDC hdc, INT x, INT y )
return metadc_param2( hdc, META_SETVIEWPORTORG, x, y );
}
BOOL CDECL MFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size )
BOOL METADC_SetWindowExtEx( HDC hdc, INT x, INT y )
{
return MFDRV_MetaParam2( dev, META_SETWINDOWEXT, x, y );
return metadc_param2( hdc, META_SETWINDOWEXT, x, y );
}
BOOL CDECL MFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )

View File

@ -196,7 +196,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_SetTextColor, /* pSetTextColor */
NULL, /* pSetViewportExtEx */
NULL, /* pSetViewportOrgEx */
MFDRV_SetWindowExtEx, /* pSetWindowExtEx */
NULL, /* pSetWindowExtEx */
MFDRV_SetWindowOrgEx, /* pSetWindowOrgEx */
NULL, /* pSetWorldTransform */
NULL, /* pStartDoc */

View File

@ -99,7 +99,6 @@ extern COLORREF CDECL MFDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_H
extern COLORREF CDECL MFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetWindowExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_StretchBlt( PHYSDEV devDst, struct bitblt_coords *dst,
PHYSDEV devSrc, struct bitblt_coords *src, DWORD rop ) DECLSPEC_HIDDEN;