gdi32: Handle metafiles directly in SetViewportExtEx.

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:40 +01:00 committed by Alexandre Julliard
parent ec4297f1e7
commit 93b57dba6d
10 changed files with 36 additions and 38 deletions

View File

@ -220,23 +220,15 @@ BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode )
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
BOOL EMFDC_SetViewportExtEx( DC_ATTR *dc_attr, INT cx, INT cy )
{
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetViewportExtEx );
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
EMRSETVIEWPORTEXTEX emr;
BOOL ret;
emr.emr.iType = EMR_SETVIEWPORTEXTEX;
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->pSetViewportExtEx( next, cx, cy, size );
physDev->modifying_transform--;
return ret;
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL CDECL EMFDRV_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )

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_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) 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;

View File

@ -129,7 +129,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pSetDeviceGammaRamp */
EMFDRV_SetPixel, /* pSetPixel */
EMFDRV_SetTextColor, /* pSetTextColor */
EMFDRV_SetViewportExtEx, /* pSetViewportExtEx */
NULL, /* pSetViewportExtEx */
EMFDRV_SetViewportOrgEx, /* pSetViewportOrgEx */
EMFDRV_SetWindowExtEx, /* pSetWindowExtEx */
EMFDRV_SetWindowOrgEx, /* pSetWindowOrgEx */

View File

@ -98,6 +98,7 @@ extern BOOL METADC_SetROP2( HDC hdc, INT rop ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetStretchBltMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
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;
/* enhanced metafiles */
extern BOOL EMFDC_AbortPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
@ -164,5 +165,6 @@ extern BOOL EMFDC_SetROP2( DC_ATTR *dc_attr, INT rop ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetStretchBltMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
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;
#endif /* __WINE_GDI_PRIVATE_H */

View File

@ -476,6 +476,25 @@ BOOL WINAPI GetViewportExtEx( HDC hdc, SIZE *size )
return TRUE;
}
/***********************************************************************
* SetViewportExtEx (GDI32.@)
*/
BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc )) return METADC_SetViewportExtEx( hdc, x, y );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_SetViewportExtEx( dc_attr, x, y )) return FALSE;
if (size) *size = dc_attr->vport_ext;
if (dc_attr->map_mode != MM_ISOTROPIC && dc_attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!x || !y) return FALSE;
dc_attr->vport_ext.cx = x;
dc_attr->vport_ext.cy = y;
return NtGdiComputeXformCoefficients( hdc );
}
/***********************************************************************
* GetViewportOrgEx (GDI32.@)
*/

View File

@ -172,17 +172,6 @@ BOOL set_map_mode( DC *dc, int mode )
BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
{
DC *dc = get_nulldrv_dc( dev );
if (size)
*size = dc->attr->vport_ext;
if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!cx || !cy) return FALSE;
dc->attr->vport_ext.cx = cx;
dc->attr->vport_ext.cy = cy;
if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
}
@ -370,20 +359,17 @@ void lp_to_dp( DC *dc, POINT *points, INT count )
/***********************************************************************
* SetViewportExtEx (GDI32.@)
* NtGdiComputeXformCoefficients (win32u.@)
*/
BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size )
BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc )
{
BOOL ret = FALSE;
DC * dc = get_dc_ptr( hdc );
DC *dc;
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetViewportExtEx );
ret = physdev->funcs->pSetViewportExtEx( physdev, x, y, size );
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
release_dc_ptr( dc );
}
return ret;
return TRUE;
}

View File

@ -95,9 +95,9 @@ BOOL METADC_SetMapMode( HDC hdc, INT mode )
return metadc_param1( hdc, META_SETMAPMODE, mode );
}
BOOL CDECL MFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size )
BOOL METADC_SetViewportExtEx( HDC hdc, INT x, INT y )
{
return MFDRV_MetaParam2( dev, META_SETVIEWPORTEXT, x, y );
return metadc_param2( hdc, META_SETVIEWPORTEXT, x, y );
}
BOOL CDECL MFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )

View File

@ -194,7 +194,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pSetDeviceGammaRamp */
NULL, /* pSetPixel */
MFDRV_SetTextColor, /* pSetTextColor */
MFDRV_SetViewportExtEx, /* pSetViewportExtEx */
NULL, /* pSetViewportExtEx */
MFDRV_SetViewportOrgEx, /* pSetViewportOrgEx */
MFDRV_SetWindowExtEx, /* pSetWindowExtEx */
MFDRV_SetWindowOrgEx, /* pSetWindowOrgEx */

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_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) 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;

View File

@ -153,6 +153,7 @@ BOOL WINAPI NtGdiBeginPath( HDC hdc );
BOOL WINAPI NtGdiCancelDC( HDC hdc );
BOOL WINAPI NtGdiCloseFigure( HDC hdc );
INT WINAPI NtGdiCombineRgn( HRGN dest, HRGN src1, HRGN src2, INT mode );
BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc );
HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
UINT bpp, const void *bits );
HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen );