From: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/gdi32/enhmfdrv/dc.c | 12 ++---------
dlls/gdi32/enhmfdrv/enhmetafiledrv.h | 1 -
dlls/gdi32/enhmfdrv/init.c | 2 +-
dlls/gdi32/gdi_private.h | 2 ++
dlls/gdi32/gdidc.c | 19 ++++++++++++++++++
dlls/gdi32/mapping.c | 30 ++++++++--------------------
dlls/gdi32/mfdrv/dc.c | 4 ++--
dlls/gdi32/mfdrv/init.c | 2 +-
dlls/gdi32/mfdrv/metafiledrv.h | 1 -
include/ntgdi.h | 1 +
10 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index 6b843b5a641..13d4a491faa 100644
--- a/dlls/gdi32/enhmfdrv/dc.c
+++ b/dlls/gdi32/enhmfdrv/dc.c
@@ -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 )
diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
index 5b764c523b5..b77c538aa75 100644
--- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
+++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h
@@ -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;
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index 0b2a81b4184..6918dd76c9b 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -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 */
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 0d23b254128..f74b45a6f98 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -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 */
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index fa947d56b79..52258a4f71f 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -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.@)
*/
diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index d5d82c8aef9..29eed8da843 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -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 );
- release_dc_ptr( dc );
- }
- return ret;
+ 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 TRUE;
}
diff --git a/dlls/gdi32/mfdrv/dc.c b/dlls/gdi32/mfdrv/dc.c
index fe89b0b6d5e..20d12a5ada6 100644
--- a/dlls/gdi32/mfdrv/dc.c
+++ b/dlls/gdi32/mfdrv/dc.c
@@ -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 )
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index 2406f737362..7eec8eb9d70 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -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 */
diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h
index 74015babb30..f478508bc4b 100644
--- a/dlls/gdi32/mfdrv/metafiledrv.h
+++ b/dlls/gdi32/mfdrv/metafiledrv.h
@@ -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;
diff --git a/include/ntgdi.h b/include/ntgdi.h
index d2b5576d316..e3600aa8c79 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -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 );
--
2.23.0