From f37e4ff931e96d8380d24e0afb55eeb4a8e08eb2 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 5 Aug 2021 11:26:28 +0200 Subject: [PATCH] gdi32: Use DC_ATTR for SetTextCharacterExtra implementation. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/font.c | 23 ----------------------- dlls/gdi32/gdi_private.h | 1 + dlls/gdi32/gdidc.c | 15 +++++++++++++++ dlls/gdi32/mfdrv/dc.c | 4 ++-- dlls/gdi32/mfdrv/init.c | 2 +- dlls/gdi32/mfdrv/metafiledrv.h | 1 - 6 files changed, 19 insertions(+), 27 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 2590a30c10b..3cc965627b4 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -4735,29 +4735,6 @@ INT WINAPI EnumFontsW( HDC hDC, LPCWSTR lpName, FONTENUMPROCW efproc, } -/*********************************************************************** - * SetTextCharacterExtra (GDI32.@) - */ -INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra ) -{ - INT ret = 0x80000000; - DC * dc = get_dc_ptr( hdc ); - - if (dc) - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetTextCharacterExtra ); - extra = physdev->funcs->pSetTextCharacterExtra( physdev, extra ); - if (extra != 0x80000000) - { - ret = dc->attr->char_extra; - dc->attr->char_extra = extra; - } - release_dc_ptr( dc ); - } - return ret; -} - - /*********************************************************************** * NtGdiSetTextJustification (win32u.@) */ diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 0ef6cc121d8..ef4541e2543 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -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_SetTextCharacterExtra( HDC hdc, INT extra ) 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; diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index 0c2d794a576..6372ac7d75d 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -314,6 +314,21 @@ INT WINAPI GetTextCharacterExtra( HDC hdc ) return dc_attr ? dc_attr->char_extra : 0x80000000; } +/*********************************************************************** + * SetTextCharacterExtra (GDI32.@) + */ +INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra ) +{ + DC_ATTR *dc_attr; + INT ret; + + if (is_meta_dc( hdc )) return METADC_SetTextCharacterExtra( hdc, extra ); + if (!(dc_attr = get_dc_attr( hdc ))) return 0x8000000; + ret = dc_attr->char_extra; + dc_attr->char_extra = extra; + return ret; +} + /*********************************************************************** * GetPolyFillMode (GDI32.@) */ diff --git a/dlls/gdi32/mfdrv/dc.c b/dlls/gdi32/mfdrv/dc.c index 791d812a147..659c41396d1 100644 --- a/dlls/gdi32/mfdrv/dc.c +++ b/dlls/gdi32/mfdrv/dc.c @@ -140,9 +140,9 @@ BOOL METADC_SetTextJustification( HDC hdc, INT extra, INT breaks ) return metadc_param2( hdc, META_SETTEXTJUSTIFICATION, extra, breaks ); } -INT CDECL MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra ) +BOOL METADC_SetTextCharacterExtra( HDC hdc, INT extra ) { - return MFDRV_MetaParam1( dev, META_SETTEXTCHAREXTRA, extra ) ? extra : 0x80000000; + return metadc_param1( hdc, META_SETTEXTCHAREXTRA, extra ); } DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index 6e847379563..30c16324c3b 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -198,7 +198,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = NULL, /* pSetMapMode */ MFDRV_SetMapperFlags, /* pSetMapperFlags */ NULL, /* pSetPixel */ - MFDRV_SetTextCharacterExtra, /* pSetTextCharacterExtra */ + NULL, /* pSetTextCharacterExtra */ MFDRV_SetTextColor, /* pSetTextColor */ NULL, /* pSetTextJustification */ MFDRV_SetViewportExtEx, /* pSetViewportExtEx */ diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index 264cece30ee..ed41b9fb67d 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -105,7 +105,6 @@ extern COLORREF CDECL MFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLS extern COLORREF CDECL MFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout ) 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; 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;