gdi32: Use NtGdiScaleWindowExtEx for ScaleWindowExtEx implementation.

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-06 15:59:09 +01:00 committed by Alexandre Julliard
parent 97417821ae
commit 47b0f2f64e
7 changed files with 53 additions and 37 deletions

View File

@ -309,20 +309,17 @@ BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_n
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size )
BOOL EMFDC_ScaleWindowExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom )
{
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pScaleWindowExtEx );
EMRSCALEWINDOWEXTEX emr;
emr.emr.iType = EMR_SCALEWINDOWEXTEX;
emr.emr.nSize = sizeof(emr);
emr.xNum = xNum;
emr.xDenom = xDenom;
emr.yNum = yNum;
emr.yDenom = yDenom;
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
return next->funcs->pScaleWindowExtEx( next, xNum, xDenom, yNum, yDenom, size );
emr.xNum = x_num;
emr.xDenom = x_denom;
emr.yNum = y_num;
emr.yDenom = y_denom;
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout )

View File

@ -115,7 +115,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_RestoreDC, /* pRestoreDC */
EMFDRV_RoundRect, /* pRoundRect */
NULL, /* pScaleViewportExtEx */
EMFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */
NULL, /* pScaleWindowExtEx */
EMFDRV_SelectBitmap, /* pSelectBitmap */
EMFDRV_SelectBrush, /* pSelectBrush */
EMFDRV_SelectClipPath, /* pSelectClipPath */

View File

@ -77,6 +77,8 @@ extern BOOL METADC_RoundRect( HDC hdc, INT left, INT top, INT right, INT bottom,
extern BOOL METADC_SaveDC( HDC hdc ) DECLSPEC_HIDDEN;
extern BOOL METADC_ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num,
INT y_denom ) DECLSPEC_HIDDEN;
extern BOOL METADC_ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num,
INT y_denom ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetBkMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetLayout( HDC hdc, DWORD layout ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextCharacterExtra( HDC hdc, INT extra ) DECLSPEC_HIDDEN;
@ -140,6 +142,8 @@ extern BOOL EMFDC_RoundRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT
extern BOOL EMFDC_SaveDC( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num,
INT y_denom ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_ScaleWindowExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num,
INT y_denom ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout ) DECLSPEC_HIDDEN;

View File

@ -1247,6 +1247,21 @@ BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom,
return NtGdiScaleViewportExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
}
/***********************************************************************
* ScaleWindowExtEx (GDI32.@)
*/
BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
INT y_num, INT y_denom, SIZE *size )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc )) return METADC_ScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_ScaleWindowExtEx( dc_attr, x_num, x_denom, y_num, y_denom ))
return FALSE;
return NtGdiScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
}
/***********************************************************************
* GdiSetPixelFormat (GDI32.@)
*/

View File

@ -118,20 +118,6 @@ BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT
BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, 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 (!x_num || !x_denom || !y_num || !y_denom) return FALSE;
dc->attr->wnd_ext.cx = (dc->attr->wnd_ext.cx * x_num) / x_denom;
dc->attr->wnd_ext.cy = (dc->attr->wnd_ext.cy * y_num) / y_denom;
if (dc->attr->wnd_ext.cx == 0) dc->attr->wnd_ext.cx = 1;
if (dc->attr->wnd_ext.cy == 0) dc->attr->wnd_ext.cy = 1;
if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
}
@ -535,21 +521,35 @@ BOOL WINAPI NtGdiScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom,
/***********************************************************************
* ScaleWindowExtEx (GDI32.@)
* NtGdiScaleWindowExtEx (win32u.@)
*/
BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT xNum, INT xDenom,
INT yNum, INT yDenom, LPSIZE size )
BOOL WINAPI NtGdiScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
INT y_num, INT y_denom, SIZE *size )
{
BOOL ret = FALSE;
DC * dc = get_dc_ptr( hdc );
DC *dc;
if (dc)
if ((!(dc = get_dc_ptr( hdc )))) return FALSE;
if (size) *size = dc->attr->wnd_ext;
if (dc->attr->map_mode == MM_ISOTROPIC || dc->attr->map_mode == MM_ANISOTROPIC)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pScaleWindowExtEx );
ret = physdev->funcs->pScaleWindowExtEx( physdev, xNum, xDenom, yNum, yDenom, size );
release_dc_ptr( dc );
if (!x_num || !x_denom || !y_num || !y_denom)
{
release_dc_ptr( dc );
return FALSE;
}
dc->attr->wnd_ext.cx = (dc->attr->wnd_ext.cx * x_num) / x_denom;
dc->attr->wnd_ext.cy = (dc->attr->wnd_ext.cy * y_num) / y_denom;
if (dc->attr->wnd_ext.cx == 0) dc->attr->wnd_ext.cx = 1;
if (dc->attr->wnd_ext.cy == 0) dc->attr->wnd_ext.cy = 1;
if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
}
return ret;
release_dc_ptr( dc );
return TRUE;
}

View File

@ -130,9 +130,9 @@ BOOL METADC_ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num, INT
return metadc_param4( hdc, META_SCALEVIEWPORTEXT, x_num, x_denom, y_num, y_denom );
}
BOOL CDECL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size )
BOOL METADC_ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num, INT y_denom )
{
return MFDRV_MetaParam4( dev, META_SCALEWINDOWEXT, xNum, xDenom, yNum, yDenom );
return metadc_param4( hdc, META_SCALEWINDOWEXT, x_num, x_denom, y_num, y_denom );
}
BOOL METADC_SetTextJustification( HDC hdc, INT extra, INT breaks )

View File

@ -180,7 +180,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_RestoreDC, /* pRestoreDC */
NULL, /* pRoundRect */
NULL, /* pScaleViewportExtEx */
MFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */
NULL, /* pScaleWindowExtEx */
MFDRV_SelectBitmap, /* pSelectBitmap */
MFDRV_SelectBrush, /* pSelectBrush */
MFDRV_SelectClipPath, /* pSelectClipPath */