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 | 20 ++++-------- dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 2 -- dlls/gdi32/enhmfdrv/init.c | 2 +- dlls/gdi32/gdi_private.h | 4 +++ dlls/gdi32/gdidc.c | 14 ++++++++ dlls/gdi32/mapping.c | 48 ++++++++++++++-------------- dlls/gdi32/mfdrv/dc.c | 4 +-- dlls/gdi32/mfdrv/init.c | 2 +- dlls/gdi32/mfdrv/metafiledrv.h | 1 - 9 files changed, 52 insertions(+), 45 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index 521d529728f..f544a5ab998 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -296,25 +296,17 @@ BOOL CDECL EMFDRV_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) return ret; }
-BOOL CDECL EMFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) +BOOL EMFDC_ScaleViewportExtEx( DC_ATTR *dc_attr, INT x_num, INT x_denom, INT y_num, INT y_denom ) { - PHYSDEV next = GET_NEXT_PHYSDEV( dev, pScaleViewportExtEx ); - EMFDRV_PDEVICE *physDev = get_emf_physdev( dev ); EMRSCALEVIEWPORTEXTEX emr; - BOOL ret;
emr.emr.iType = EMR_SCALEVIEWPORTEXTEX; 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; - physDev->modifying_transform++; - ret = next->funcs->pScaleViewportExtEx( next, xNum, xDenom, yNum, yDenom, size ); - physDev->modifying_transform--; - return ret; + 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 CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h index d165f153a22..1cb580dfc36 100644 --- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h +++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h @@ -98,8 +98,6 @@ extern BOOL CDECL EMFDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT righ extern BOOL CDECL EMFDRV_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) DECLSPEC_HIDDEN; -extern BOOL CDECL EMFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, - INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern HBITMAP CDECL EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index 63784f62841..5b7c27f5fe1 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -114,7 +114,7 @@ static const struct gdi_dc_funcs emfdrv_driver = NULL, /* pResetDC */ EMFDRV_RestoreDC, /* pRestoreDC */ EMFDRV_RoundRect, /* pRoundRect */ - EMFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */ + NULL, /* pScaleViewportExtEx */ EMFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */ EMFDRV_SelectBitmap, /* pSelectBitmap */ EMFDRV_SelectBrush, /* pSelectBrush */ diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 53a4ba267d4..895525317cc 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -75,6 +75,8 @@ extern BOOL METADC_Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom) extern BOOL METADC_RoundRect( HDC hdc, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) 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, + 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; @@ -136,6 +138,8 @@ extern BOOL EMFDC_Rectangle( DC_ATTR *dc_attr, INT left, INT top, INT right, extern BOOL EMFDC_RoundRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) 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, + 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 69e59c580f0..341944c70da 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -1232,6 +1232,20 @@ BOOL WINAPI LPtoDP( HDC hdc, POINT *points, INT count ) return NtGdiTransformPoints( hdc, points, points, count, NtGdiLPtoDP ); }
+/*********************************************************************** + * ScaleViewportExtEx (GDI32.@) + */ +BOOL WINAPI ScaleViewportExtEx( 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_ScaleViewportExtEx( hdc, x_num, x_denom, y_num, y_denom ); + if (!(dc_attr = get_dc_attr( hdc ))) return FALSE; + if (dc_attr->emf && !EMFDC_ScaleViewportExtEx( dc_attr, x_num, x_denom, y_num, y_denom )) + return FALSE; + return NtGdiScaleViewportExtEx( 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 7ec20957e92..09ecec4f717 100644 --- a/dlls/gdi32/mapping.c +++ b/dlls/gdi32/mapping.c @@ -113,20 +113,6 @@ BOOL CDECL nulldrv_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
BOOL CDECL nulldrv_ScaleViewportExtEx( 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->vport_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->vport_ext.cx = (dc->attr->vport_ext.cx * x_num) / x_denom; - dc->attr->vport_ext.cy = (dc->attr->vport_ext.cy * y_num) / y_denom; - if (dc->attr->vport_ext.cx == 0) dc->attr->vport_ext.cx = 1; - if (dc->attr->vport_ext.cy == 0) dc->attr->vport_ext.cy = 1; - if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); - DC_UpdateXforms( dc ); return TRUE; }
@@ -516,21 +502,35 @@ BOOL WINAPI OffsetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt )
/*********************************************************************** - * ScaleViewportExtEx (GDI32.@) + * NtGdiScaleViewportExtEx (win32u.@) */ -BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT xNum, INT xDenom, - INT yNum, INT yDenom, LPSIZE size ) +BOOL WINAPI NtGdiScaleViewportExtEx( 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->vport_ext; + + if (dc->attr->map_mode == MM_ISOTROPIC || dc->attr->map_mode == MM_ANISOTROPIC) { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pScaleViewportExtEx ); - ret = physdev->funcs->pScaleViewportExtEx( 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->vport_ext.cx = (dc->attr->vport_ext.cx * x_num) / x_denom; + dc->attr->vport_ext.cy = (dc->attr->vport_ext.cy * y_num) / y_denom; + if (dc->attr->vport_ext.cx == 0) dc->attr->vport_ext.cx = 1; + if (dc->attr->vport_ext.cy == 0) dc->attr->vport_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 7172d74ebb8..c96b1053eb5 100644 --- a/dlls/gdi32/mfdrv/dc.c +++ b/dlls/gdi32/mfdrv/dc.c @@ -125,9 +125,9 @@ BOOL CDECL MFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) return MFDRV_MetaParam2( dev, META_OFFSETWINDOWORG, x, y ); }
-BOOL CDECL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) +BOOL METADC_ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num, INT y_denom ) { - return MFDRV_MetaParam4( dev, META_SCALEVIEWPORTEXT, xNum, xDenom, yNum, yDenom ); + 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 ) diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index 6af270c709e..9641887cb23 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -179,7 +179,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = NULL, /* pResetDC */ MFDRV_RestoreDC, /* pRestoreDC */ NULL, /* pRoundRect */ - MFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */ + NULL, /* pScaleViewportExtEx */ MFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */ MFDRV_SelectBitmap, /* pSelectBitmap */ MFDRV_SelectBrush, /* pSelectBrush */ diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index fb3326af36e..9610a2fb17d 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -91,7 +91,6 @@ extern BOOL CDECL MFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt extern BOOL CDECL MFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_PolyBezierTo( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN; -extern BOOL CDECL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN; extern HBITMAP CDECL MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN; extern HBRUSH CDECL MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;