From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/gdi32/enhmfdrv/dc.c | 15 +++++------- dlls/gdi32/enhmfdrv/init.c | 2 +- dlls/gdi32/gdi_private.h | 4 ++++ dlls/gdi32/gdidc.c | 15 ++++++++++++ dlls/gdi32/mapping.c | 48 +++++++++++++++++++------------------- dlls/gdi32/mfdrv/dc.c | 4 ++-- dlls/gdi32/mfdrv/init.c | 2 +- 7 files changed, 53 insertions(+), 37 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index f544a5ab998..6b843b5a641 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -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 ) diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index 5b7c27f5fe1..b104d58b6be 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -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 */ diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 895525317cc..ebea5565725 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -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; diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index 341944c70da..f3afb75a67e 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -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.@) */ diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c index 09ecec4f717..189481c2e3e 100644 --- a/dlls/gdi32/mapping.c +++ b/dlls/gdi32/mapping.c @@ -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; }
diff --git a/dlls/gdi32/mfdrv/dc.c b/dlls/gdi32/mfdrv/dc.c index c96b1053eb5..fe89b0b6d5e 100644 --- a/dlls/gdi32/mfdrv/dc.c +++ b/dlls/gdi32/mfdrv/dc.c @@ -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 ) diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index 9641887cb23..a860932d012 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -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 */