Commit 22df510e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use ntgdi interface for SetLayout implementation.

parent 6cb07a71
...@@ -1286,26 +1286,30 @@ UINT WINAPI NtGdiSetBoundsRect( HDC hdc, const RECT *rect, UINT flags ) ...@@ -1286,26 +1286,30 @@ UINT WINAPI NtGdiSetBoundsRect( HDC hdc, const RECT *rect, UINT flags )
/*********************************************************************** /***********************************************************************
* SetLayout (GDI32.@) * NtGdiSetLayout (win32u.@)
* *
* Sets left->right or right->left text layout flags of a dc. * Sets left->right or right->left text layout flags of a dc.
* *
*/ */
DWORD WINAPI SetLayout(HDC hdc, DWORD layout) DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout )
{ {
DWORD oldlayout = GDI_ERROR; DWORD old_layout = GDI_ERROR;
DC *dc;
DC * dc = get_dc_ptr( hdc ); if ((dc = get_dc_ptr( hdc )))
if (dc)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetLayout ); old_layout = dc->attr->layout;
oldlayout = physdev->funcs->pSetLayout( physdev, layout ); dc->attr->layout = layout;
release_dc_ptr( dc ); if (layout != old_layout)
{
if (layout & LAYOUT_RTL) dc->attr->map_mode = MM_ANISOTROPIC;
DC_UpdateXforms( dc );
}
} }
TRACE("hdc : %p, old layout : %08x, new layout : %08x\n", hdc, oldlayout, layout); TRACE("hdc : %p, old layout : %08x, new layout : %08x\n", hdc, old_layout, layout);
return oldlayout; return old_layout;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -787,18 +787,7 @@ static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn ) ...@@ -787,18 +787,7 @@ static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
static DWORD CDECL nulldrv_SetLayout( PHYSDEV dev, DWORD layout ) static DWORD CDECL nulldrv_SetLayout( PHYSDEV dev, DWORD layout )
{ {
DC *dc = get_nulldrv_dc( dev ); return layout;
DWORD old_layout;
old_layout = dc->attr->layout;
dc->attr->layout = layout;
if (layout != old_layout)
{
if (layout & LAYOUT_RTL) dc->attr->map_mode = MM_ANISOTROPIC;
DC_UpdateXforms( dc );
}
return old_layout;
} }
static BOOL CDECL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp ) static BOOL CDECL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
......
...@@ -333,21 +333,14 @@ BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, ...@@ -333,21 +333,14 @@ BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum,
return next->funcs->pScaleWindowExtEx( next, xNum, xDenom, yNum, yDenom, size ); return next->funcs->pScaleWindowExtEx( next, xNum, xDenom, yNum, yDenom, size );
} }
DWORD CDECL EMFDRV_SetLayout( PHYSDEV dev, DWORD layout ) BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout )
{ {
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetLayout );
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
EMRSETLAYOUT emr; EMRSETLAYOUT emr;
DWORD ret;
emr.emr.iType = EMR_SETLAYOUT; emr.emr.iType = EMR_SETLAYOUT;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = layout; emr.iMode = layout;
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return GDI_ERROR; return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
physDev->modifying_transform++;
ret = next->funcs->pSetLayout( next, layout );
physDev->modifying_transform--;
return ret;
} }
BOOL CDECL EMFDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform) BOOL CDECL EMFDRV_SetWorldTransform( PHYSDEV dev, const XFORM *xform)
......
...@@ -114,7 +114,6 @@ extern COLORREF CDECL EMFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSP ...@@ -114,7 +114,6 @@ extern COLORREF CDECL EMFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSP
extern INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, extern INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc,
INT ySrc, UINT startscan, UINT lines, LPCVOID bits, INT ySrc, UINT startscan, UINT lines, LPCVOID bits,
BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN; BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
extern DWORD CDECL EMFDRV_SetLayout( PHYSDEV dev, DWORD layout ) 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_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
......
...@@ -129,7 +129,7 @@ static const struct gdi_dc_funcs emfdrv_driver = ...@@ -129,7 +129,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */ EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
NULL, /* pSetDeviceClipping */ NULL, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
EMFDRV_SetLayout, /* pSetLayout */ NULL, /* pSetLayout */
NULL, /* pSetMapMode */ NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */ NULL, /* pSetMapperFlags */
EMFDRV_SetPixel, /* pSetPixel */ EMFDRV_SetPixel, /* pSetPixel */
......
...@@ -76,6 +76,7 @@ extern BOOL METADC_RoundRect( HDC hdc, INT left, INT top, INT right, INT bottom, ...@@ -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; INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
extern BOOL METADC_SaveDC( HDC hdc ) DECLSPEC_HIDDEN; extern BOOL METADC_SaveDC( HDC hdc ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetBkMode( HDC hdc, INT mode ) 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; extern BOOL METADC_SetTextCharacterExtra( HDC hdc, INT extra ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetMapMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN; extern BOOL METADC_SetMapMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetMapperFlags( HDC hdc, DWORD flags ) DECLSPEC_HIDDEN; extern BOOL METADC_SetMapperFlags( HDC hdc, DWORD flags ) DECLSPEC_HIDDEN;
...@@ -137,6 +138,7 @@ extern BOOL EMFDC_RoundRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT ...@@ -137,6 +138,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_SaveDC( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) 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_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN; extern BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetMapperFlags( DC_ATTR *dc_attr, DWORD flags ) DECLSPEC_HIDDEN; extern BOOL EMFDC_SetMapperFlags( DC_ATTR *dc_attr, DWORD flags ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetPixel( DC_ATTR *dc_attr, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN; extern BOOL EMFDC_SetPixel( DC_ATTR *dc_attr, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
......
...@@ -281,6 +281,19 @@ DWORD WINAPI GetLayout( HDC hdc ) ...@@ -281,6 +281,19 @@ DWORD WINAPI GetLayout( HDC hdc )
} }
/*********************************************************************** /***********************************************************************
* SetLayout (GDI32.@)
*/
DWORD WINAPI SetLayout( HDC hdc, DWORD layout )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc )) return METADC_SetLayout( hdc, layout );
if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
if (dc_attr->emf && !EMFDC_SetLayout( dc_attr, layout )) return GDI_ERROR;
return NtGdiSetLayout( hdc, -1, layout );
}
/***********************************************************************
* GetMapMode (GDI32.@) * GetMapMode (GDI32.@)
*/ */
INT WINAPI GetMapMode( HDC hdc ) INT WINAPI GetMapMode( HDC hdc )
......
...@@ -85,9 +85,9 @@ BOOL METADC_OffsetClipRgn( HDC hdc, INT x, INT y ) ...@@ -85,9 +85,9 @@ BOOL METADC_OffsetClipRgn( HDC hdc, INT x, INT y )
return metadc_param2( hdc, META_OFFSETCLIPRGN, x, y ); return metadc_param2( hdc, META_OFFSETCLIPRGN, x, y );
} }
DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout ) BOOL METADC_SetLayout( HDC hdc, DWORD layout )
{ {
return MFDRV_MetaParam2( dev, META_SETLAYOUT, HIWORD(layout), LOWORD(layout) ); return metadc_param2( hdc, META_SETLAYOUT, HIWORD(layout), LOWORD(layout) );
} }
BOOL METADC_SetMapMode( HDC hdc, INT mode ) BOOL METADC_SetMapMode( HDC hdc, INT mode )
......
...@@ -194,7 +194,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = ...@@ -194,7 +194,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */ MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
NULL, /* pSetDeviceClipping */ NULL, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
MFDRV_SetLayout, /* pSetLayout */ NULL, /* pSetLayout */
NULL, /* pSetMapMode */ NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */ NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */ NULL, /* pSetPixel */
......
...@@ -103,7 +103,6 @@ extern UINT CDECL MFDRV_RealizePalette(PHYSDEV dev, HPALETTE hPalette, BOOL prim ...@@ -103,7 +103,6 @@ extern UINT CDECL MFDRV_RealizePalette(PHYSDEV dev, HPALETTE hPalette, BOOL prim
extern COLORREF CDECL MFDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF CDECL MFDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; 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_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetTextColor( 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_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_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
......
...@@ -251,7 +251,7 @@ BOOL WINAPI NtGdiSetBitmapDimension( HBITMAP hbitmap, INT x, INT y, SIZE *pr ...@@ -251,7 +251,7 @@ BOOL WINAPI NtGdiSetBitmapDimension( HBITMAP hbitmap, INT x, INT y, SIZE *pr
BOOL WINAPI NtGdiSetBrushOrg( HDC hdc, INT x, INT y, POINT *prev_org ); BOOL WINAPI NtGdiSetBrushOrg( HDC hdc, INT x, INT y, POINT *prev_org );
UINT WINAPI NtGdiSetBoundsRect( HDC hdc, const RECT *rect, UINT flags ); UINT WINAPI NtGdiSetBoundsRect( HDC hdc, const RECT *rect, UINT flags );
BOOL WINAPI NtGdiSetDeviceGammaRamp( HDC hdc, void *ptr ); BOOL WINAPI NtGdiSetDeviceGammaRamp( HDC hdc, void *ptr );
DWORD WINAPI NtGdiSetLayout( HDC hdc, DWORD layout ); DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout );
INT WINAPI NtGdiSetMetaRgn( HDC hdc ); INT WINAPI NtGdiSetMetaRgn( HDC hdc );
BOOL WINAPI NtGdiSetMiterLimit( HDC hdc, FLOAT limit, FLOAT *prev_limit ); BOOL WINAPI NtGdiSetMiterLimit( HDC hdc, FLOAT limit, FLOAT *prev_limit );
COLORREF WINAPI NtGdiSetPixel( HDC hdc, INT x, INT y, COLORREF color ); COLORREF WINAPI NtGdiSetPixel( HDC hdc, INT x, INT y, COLORREF color );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment