mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 12:30:58 +00:00
gdi32: Use ntgdi interface for SetMapMode 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:
parent
32317fb1e5
commit
f7824d4382
|
@ -854,6 +854,34 @@ COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* NtGdiGetAndSetDCDword (win32u.@)
|
||||
*/
|
||||
BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *prev_value )
|
||||
{
|
||||
BOOL ret;
|
||||
DC *dc;
|
||||
|
||||
if (!(dc = get_dc_ptr( hdc ))) return 0;
|
||||
|
||||
switch (method)
|
||||
{
|
||||
case NtGdiSetMapMode:
|
||||
*prev_value = dc->attr->map_mode;
|
||||
ret = set_map_mode( dc, value );
|
||||
break;
|
||||
|
||||
default:
|
||||
WARN( "unknown method %u\n", method );
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
release_dc_ptr( dc );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetGraphicsMode (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -210,22 +210,14 @@ BOOL EMFDC_ExtSelectClipRgn( DC_ATTR *dc_attr, HRGN hrgn, INT mode )
|
|||
return ret;
|
||||
}
|
||||
|
||||
INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode )
|
||||
BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode )
|
||||
{
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetMapMode );
|
||||
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
|
||||
EMRSETMAPMODE emr;
|
||||
INT ret;
|
||||
|
||||
emr.emr.iType = EMR_SETMAPMODE;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.iMode = mode;
|
||||
|
||||
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return 0;
|
||||
physDev->modifying_transform++;
|
||||
ret = next->funcs->pSetMapMode( next, mode );
|
||||
physDev->modifying_transform--;
|
||||
return ret;
|
||||
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
|
||||
}
|
||||
|
||||
BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
|
||||
|
|
|
@ -115,7 +115,6 @@ extern INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDes
|
|||
INT ySrc, UINT startscan, UINT lines, LPCVOID bits,
|
||||
BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
|
||||
extern DWORD CDECL EMFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DECLSPEC_HIDDEN;
|
||||
extern INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) 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;
|
||||
|
|
|
@ -130,7 +130,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
|
|||
NULL, /* pSetDeviceClipping */
|
||||
NULL, /* pSetDeviceGammaRamp */
|
||||
EMFDRV_SetLayout, /* pSetLayout */
|
||||
EMFDRV_SetMapMode, /* pSetMapMode */
|
||||
NULL, /* pSetMapMode */
|
||||
EMFDRV_SetMapperFlags, /* pSetMapperFlags */
|
||||
EMFDRV_SetPixel, /* pSetPixel */
|
||||
NULL, /* pSetTextCharacterExtra */
|
||||
|
|
|
@ -76,6 +76,7 @@ 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_SetBkMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SetMapMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SetPixel( HDC hdc, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SetPolyFillMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SetRelAbs( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
|
||||
|
@ -134,6 +135,7 @@ 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_SetArcDirection( DC_ATTR *dc_attr, INT dir ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetPixel( DC_ATTR *dc_attr, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetPolyFillMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetROP2( DC_ATTR *dc_attr, INT rop ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -289,6 +289,22 @@ INT WINAPI GetMapMode( HDC hdc )
|
|||
return dc_attr ? dc_attr->map_mode : 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetMapMode (GDI32.@)
|
||||
*/
|
||||
INT WINAPI SetMapMode( HDC hdc, INT mode )
|
||||
{
|
||||
DC_ATTR *dc_attr;
|
||||
DWORD ret;
|
||||
|
||||
TRACE("%p %d\n", hdc, mode );
|
||||
|
||||
if (is_meta_dc( hdc )) return METADC_SetMapMode( hdc, mode );
|
||||
if (!(dc_attr = get_dc_attr( hdc ))) return 0;
|
||||
if (dc_attr->emf && !EMFDC_SetMapMode( dc_attr, mode )) return 0;
|
||||
return NtGdiGetAndSetDCDword( hdc, NtGdiSetMapMode, mode, &ret ) ? ret : 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetPolyFillMode (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -151,11 +151,15 @@ BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_
|
|||
|
||||
INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode )
|
||||
{
|
||||
DC *dc = get_nulldrv_dc( dev );
|
||||
INT ret = dc->attr->map_mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL set_map_mode( DC *dc, int mode )
|
||||
{
|
||||
SIZE virtual_size, virtual_res;
|
||||
|
||||
if (mode == dc->attr->map_mode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC)) return ret;
|
||||
if (mode == dc->attr->map_mode && (mode == MM_ISOTROPIC || mode == MM_ANISOTROPIC))
|
||||
return TRUE;
|
||||
|
||||
virtual_size = get_dc_virtual_size( dc );
|
||||
virtual_res = get_dc_virtual_res( dc );
|
||||
|
@ -201,12 +205,12 @@ INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode )
|
|||
case MM_ANISOTROPIC:
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
/* RTL layout is always MM_ANISOTROPIC */
|
||||
if (!(dc->attr->layout & LAYOUT_RTL)) dc->attr->map_mode = mode;
|
||||
DC_UpdateXforms( dc );
|
||||
return ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
|
||||
|
@ -407,25 +411,6 @@ void lp_to_dp( DC *dc, POINT *points, INT count )
|
|||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetMapMode (GDI32.@)
|
||||
*/
|
||||
INT WINAPI SetMapMode( HDC hdc, INT mode )
|
||||
{
|
||||
INT ret = 0;
|
||||
DC * dc = get_dc_ptr( hdc );
|
||||
|
||||
TRACE("%p %d\n", hdc, mode );
|
||||
|
||||
if (dc)
|
||||
{
|
||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetMapMode );
|
||||
ret = physdev->funcs->pSetMapMode( physdev, mode );
|
||||
release_dc_ptr( dc );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetViewportExtEx (GDI32.@)
|
||||
|
|
|
@ -90,9 +90,9 @@ DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout )
|
|||
return MFDRV_MetaParam2( dev, META_SETLAYOUT, HIWORD(layout), LOWORD(layout) );
|
||||
}
|
||||
|
||||
INT CDECL MFDRV_SetMapMode( PHYSDEV dev, INT mode )
|
||||
BOOL METADC_SetMapMode( HDC hdc, INT mode )
|
||||
{
|
||||
return MFDRV_MetaParam1( dev, META_SETMAPMODE, mode );
|
||||
return metadc_param1( hdc, META_SETMAPMODE, mode );
|
||||
}
|
||||
|
||||
BOOL CDECL MFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size )
|
||||
|
|
|
@ -195,7 +195,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
|
|||
NULL, /* pSetDeviceClipping */
|
||||
NULL, /* pSetDeviceGammaRamp */
|
||||
MFDRV_SetLayout, /* pSetLayout */
|
||||
MFDRV_SetMapMode, /* pSetMapMode */
|
||||
NULL, /* pSetMapMode */
|
||||
MFDRV_SetMapperFlags, /* pSetMapperFlags */
|
||||
NULL, /* pSetPixel */
|
||||
MFDRV_SetTextCharacterExtra, /* pSetTextCharacterExtra */
|
||||
|
|
|
@ -104,7 +104,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 DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DECLSPEC_HIDDEN;
|
||||
extern INT CDECL MFDRV_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DECLSPEC_HIDDEN;
|
||||
extern INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -454,6 +454,7 @@ extern DWORD get_system_dpi(void) DECLSPEC_HIDDEN;
|
|||
/* mapping.c */
|
||||
extern BOOL dp_to_lp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
|
||||
extern void lp_to_dp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
|
||||
extern BOOL set_map_mode( DC *dc, int mode ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* metafile.c */
|
||||
extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -99,6 +99,11 @@ enum
|
|||
NtGdiDPtoLP,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NtGdiSetMapMode = 8,
|
||||
};
|
||||
|
||||
/* structs not compatible with native Windows */
|
||||
#ifdef __WINESRC__
|
||||
|
||||
|
|
Loading…
Reference in a new issue