gdi32: Use NtGdiModifyWorldTransform for SetWorldTransform 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-13 12:08:23 +02:00 committed by Alexandre Julliard
parent eb5c039f42
commit ce94982927
6 changed files with 16 additions and 44 deletions

View file

@ -300,22 +300,14 @@ BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout )
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr ); return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
} }
BOOL CDECL EMFDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform) BOOL EMFDC_SetWorldTransform( DC_ATTR *dc_attr, const XFORM *xform )
{ {
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetWorldTransform );
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
EMRSETWORLDTRANSFORM emr; EMRSETWORLDTRANSFORM emr;
BOOL ret;
emr.emr.iType = EMR_SETWORLDTRANSFORM; emr.emr.iType = EMR_SETWORLDTRANSFORM;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.xform = *xform; emr.xform = *xform;
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
physDev->modifying_transform++;
ret = next->funcs->pSetWorldTransform( next, xform );
physDev->modifying_transform--;
return ret;
} }
BOOL EMFDC_ModifyWorldTransform( DC_ATTR *dc_attr, const XFORM *xform, DWORD mode ) BOOL EMFDC_ModifyWorldTransform( DC_ATTR *dc_attr, const XFORM *xform, DWORD mode )

View file

@ -41,7 +41,6 @@ typedef struct
HBRUSH dc_brush; HBRUSH dc_brush;
HPEN dc_pen; HPEN dc_pen;
INT restoring; /* RestoreDC counter */ INT restoring; /* RestoreDC counter */
INT modifying_transform;/* Counter for functions that can change world transform */
BOOL path; BOOL path;
INT dev_caps[COLORMGMTCAPS + 1]; INT dev_caps[COLORMGMTCAPS + 1];
} EMFDRV_PDEVICE; } EMFDRV_PDEVICE;
@ -107,7 +106,6 @@ extern INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDes
BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN; 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_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF CDECL EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform ) DECLSPEC_HIDDEN;
extern INT CDECL EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT heightDst, extern INT CDECL EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT heightDst,
INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
const void *bits, BITMAPINFO *info, UINT wUsage, DWORD dwRop ) DECLSPEC_HIDDEN; const void *bits, BITMAPINFO *info, UINT wUsage, DWORD dwRop ) DECLSPEC_HIDDEN;

View file

@ -126,7 +126,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
EMFDRV_SetPixel, /* pSetPixel */ EMFDRV_SetPixel, /* pSetPixel */
EMFDRV_SetTextColor, /* pSetTextColor */ EMFDRV_SetTextColor, /* pSetTextColor */
EMFDRV_SetWorldTransform, /* pSetWorldTransform */ NULL, /* pSetWorldTransform */
NULL, /* pStartDoc */ NULL, /* pStartDoc */
NULL, /* pStartPage */ NULL, /* pStartPage */
NULL, /* pStretchBlt */ NULL, /* pStretchBlt */
@ -338,7 +338,6 @@ HDC WINAPI CreateEnhMetaFileW(
physDev->dc_brush = 0; physDev->dc_brush = 0;
physDev->dc_pen = 0; physDev->dc_pen = 0;
physDev->restoring = 0; physDev->restoring = 0;
physDev->modifying_transform = 0;
physDev->path = FALSE; physDev->path = FALSE;
if (hdc) /* if no ref, use current display */ if (hdc) /* if no ref, use current display */

View file

@ -186,6 +186,7 @@ extern BOOL EMFDC_SetViewportExtEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HI
extern BOOL EMFDC_SetViewportOrgEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL EMFDC_SetViewportOrgEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetWindowExtEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL EMFDC_SetWindowExtEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetWindowOrgEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL EMFDC_SetWindowOrgEx( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetWorldTransform( DC_ATTR *dc_attr, const XFORM *xform ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_StretchBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst, extern BOOL EMFDC_StretchBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src, HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
DWORD rop ); DWORD rop );

View file

@ -613,6 +613,18 @@ BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform, DWORD mode )
return NtGdiModifyWorldTransform( hdc, xform, mode ); return NtGdiModifyWorldTransform( hdc, xform, mode );
} }
/***********************************************************************
* SetWorldTransform (GDI32.@)
*/
BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
{
DC_ATTR *dc_attr;
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_SetWorldTransform( dc_attr, xform )) return FALSE;
return NtGdiModifyWorldTransform( hdc, xform, MWT_SET );
}
/*********************************************************************** /***********************************************************************
* SetStretchBltMode (GDI32.@) * SetStretchBltMode (GDI32.@)
*/ */

View file

@ -148,10 +148,6 @@ BOOL CDECL nulldrv_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD
BOOL CDECL nulldrv_SetWorldTransform( PHYSDEV dev, const XFORM *xform ) BOOL CDECL nulldrv_SetWorldTransform( PHYSDEV dev, const XFORM *xform )
{ {
DC *dc = get_nulldrv_dc( dev );
dc->xformWorld2Wnd = *xform;
DC_UpdateXforms( dc );
return TRUE; return TRUE;
} }
@ -379,32 +375,6 @@ BOOL WINAPI NtGdiModifyWorldTransform( HDC hdc, const XFORM *xform, DWORD mode )
} }
/***********************************************************************
* SetWorldTransform (GDI32.@)
*/
BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
{
BOOL ret = FALSE;
DC *dc;
if (!xform) return FALSE;
/* The transform must conform to (eM11 * eM22 != eM12 * eM21) requirement */
if (xform->eM11 * xform->eM22 == xform->eM12 * xform->eM21) return FALSE;
TRACE("eM11 %f eM12 %f eM21 %f eM22 %f eDx %f eDy %f\n",
xform->eM11, xform->eM12, xform->eM21, xform->eM22, xform->eDx, xform->eDy);
if ((dc = get_dc_ptr( hdc )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetWorldTransform );
if (dc->attr->graphics_mode == GM_ADVANCED)
ret = physdev->funcs->pSetWorldTransform( physdev, xform );
release_dc_ptr( dc );
}
return ret;
}
/*********************************************************************** /***********************************************************************
* NtGdiSetVirtualResolution (win32u.@) * NtGdiSetVirtualResolution (win32u.@)
* *