Commit 47b0f2f6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiScaleWindowExtEx for ScaleWindowExtEx implementation.

parent 97417821
...@@ -309,20 +309,17 @@ BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_n ...@@ -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 ); 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; EMRSCALEWINDOWEXTEX emr;
emr.emr.iType = EMR_SCALEWINDOWEXTEX; emr.emr.iType = EMR_SCALEWINDOWEXTEX;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.xNum = xNum; emr.xNum = x_num;
emr.xDenom = xDenom; emr.xDenom = x_denom;
emr.yNum = yNum; emr.yNum = y_num;
emr.yDenom = yDenom; emr.yDenom = y_denom;
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
return next->funcs->pScaleWindowExtEx( next, xNum, xDenom, yNum, yDenom, size );
} }
BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout ) BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout )
......
...@@ -115,7 +115,7 @@ static const struct gdi_dc_funcs emfdrv_driver = ...@@ -115,7 +115,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_RestoreDC, /* pRestoreDC */ EMFDRV_RestoreDC, /* pRestoreDC */
EMFDRV_RoundRect, /* pRoundRect */ EMFDRV_RoundRect, /* pRoundRect */
NULL, /* pScaleViewportExtEx */ NULL, /* pScaleViewportExtEx */
EMFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */ NULL, /* pScaleWindowExtEx */
EMFDRV_SelectBitmap, /* pSelectBitmap */ EMFDRV_SelectBitmap, /* pSelectBitmap */
EMFDRV_SelectBrush, /* pSelectBrush */ EMFDRV_SelectBrush, /* pSelectBrush */
EMFDRV_SelectClipPath, /* pSelectClipPath */ EMFDRV_SelectClipPath, /* pSelectClipPath */
......
...@@ -77,6 +77,8 @@ extern BOOL METADC_RoundRect( HDC hdc, INT left, INT top, INT right, INT bottom, ...@@ -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_SaveDC( HDC hdc ) DECLSPEC_HIDDEN;
extern BOOL METADC_ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num, extern BOOL METADC_ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num,
INT y_denom ) DECLSPEC_HIDDEN; 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_SetBkMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetLayout( HDC hdc, DWORD layout ) DECLSPEC_HIDDEN; extern BOOL METADC_SetLayout( HDC hdc, DWORD layout ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextCharacterExtra( HDC hdc, INT extra ) 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 ...@@ -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_SaveDC( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num, extern BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num,
INT y_denom ) DECLSPEC_HIDDEN; 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_SetArcDirection( DC_ATTR *dc_attr, INT dir ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) 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; extern BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout ) DECLSPEC_HIDDEN;
......
...@@ -1248,6 +1248,21 @@ BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, ...@@ -1248,6 +1248,21 @@ BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom,
} }
/*********************************************************************** /***********************************************************************
* 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.@) * GdiSetPixelFormat (GDI32.@)
*/ */
BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR *descr ) BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR *descr )
......
...@@ -118,20 +118,6 @@ BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT ...@@ -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 ) 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; return TRUE;
} }
...@@ -535,21 +521,35 @@ BOOL WINAPI NtGdiScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, ...@@ -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, BOOL WINAPI NtGdiScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
INT yNum, INT yDenom, LPSIZE size ) INT y_num, INT y_denom, SIZE *size )
{ {
BOOL ret = FALSE; DC *dc;
DC * dc = get_dc_ptr( hdc );
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)
{
if (!x_num || !x_denom || !y_num || !y_denom)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pScaleWindowExtEx );
ret = physdev->funcs->pScaleWindowExtEx( physdev, xNum, xDenom, yNum, yDenom, size );
release_dc_ptr( dc ); release_dc_ptr( dc );
return FALSE;
} }
return ret;
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 );
}
release_dc_ptr( dc );
return TRUE;
} }
......
...@@ -130,9 +130,9 @@ BOOL METADC_ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num, INT ...@@ -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 ); 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 ) BOOL METADC_SetTextJustification( HDC hdc, INT extra, INT breaks )
......
...@@ -180,7 +180,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = ...@@ -180,7 +180,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_RestoreDC, /* pRestoreDC */ MFDRV_RestoreDC, /* pRestoreDC */
NULL, /* pRoundRect */ NULL, /* pRoundRect */
NULL, /* pScaleViewportExtEx */ NULL, /* pScaleViewportExtEx */
MFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */ NULL, /* pScaleWindowExtEx */
MFDRV_SelectBitmap, /* pSelectBitmap */ MFDRV_SelectBitmap, /* pSelectBitmap */
MFDRV_SelectBrush, /* pSelectBrush */ MFDRV_SelectBrush, /* pSelectBrush */
MFDRV_SelectClipPath, /* pSelectClipPath */ MFDRV_SelectClipPath, /* pSelectClipPath */
......
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