gdi32: Add an internal version of GetTextCharsetInfo() that takes a DC pointer.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-07-29 13:13:06 +01:00 committed by Alexandre Julliard
parent 22202eae59
commit 41f763ea87
1 changed files with 35 additions and 22 deletions

View File

@ -406,6 +406,40 @@ DWORD WINAPI GdiGetCodePage( HDC hdc )
return cp; return cp;
} }
/***********************************************************************
* get_text_charset_info
*
* Internal version of GetTextCharsetInfo() that takes a DC pointer.
*/
static UINT get_text_charset_info(DC *dc, FONTSIGNATURE *fs, DWORD flags)
{
UINT ret = DEFAULT_CHARSET;
PHYSDEV dev;
dev = GET_DC_PHYSDEV( dc, pGetTextCharsetInfo );
ret = dev->funcs->pGetTextCharsetInfo( dev, fs, flags );
if (ret == DEFAULT_CHARSET && fs)
memset(fs, 0, sizeof(FONTSIGNATURE));
return ret;
}
/***********************************************************************
* GetTextCharsetInfo (GDI32.@)
*/
UINT WINAPI GetTextCharsetInfo(HDC hdc, FONTSIGNATURE *fs, DWORD flags)
{
UINT ret = DEFAULT_CHARSET;
DC *dc = get_dc_ptr(hdc);
if (dc)
{
ret = get_text_charset_info( dc, fs, flags );
release_dc_ptr( dc );
}
return ret;
}
/*********************************************************************** /***********************************************************************
* FONT_mbtowc * FONT_mbtowc
* *
@ -646,7 +680,7 @@ static DWORD get_associated_charset_info(void)
static void update_font_code_page( DC *dc, HANDLE font ) static void update_font_code_page( DC *dc, HANDLE font )
{ {
CHARSETINFO csi; CHARSETINFO csi;
int charset = GetTextCharsetInfo( dc->hSelf, NULL, 0 ); int charset = get_text_charset_info( dc, NULL, 0 );
LOGFONTW lf; LOGFONTW lf;
GetObjectW( font, sizeof(lf), &lf ); GetObjectW( font, sizeof(lf), &lf );
@ -3688,27 +3722,6 @@ UINT WINAPI GetTextCharset(HDC hdc)
return GetTextCharsetInfo(hdc, NULL, 0); return GetTextCharsetInfo(hdc, NULL, 0);
} }
/***********************************************************************
* GetTextCharsetInfo (GDI32.@)
*/
UINT WINAPI GetTextCharsetInfo(HDC hdc, LPFONTSIGNATURE fs, DWORD flags)
{
UINT ret = DEFAULT_CHARSET;
DC *dc = get_dc_ptr(hdc);
PHYSDEV dev;
if (dc)
{
dev = GET_DC_PHYSDEV( dc, pGetTextCharsetInfo );
ret = dev->funcs->pGetTextCharsetInfo( dev, fs, flags );
release_dc_ptr( dc );
}
if (ret == DEFAULT_CHARSET && fs)
memset(fs, 0, sizeof(FONTSIGNATURE));
return ret;
}
/*********************************************************************** /***********************************************************************
* GdiGetCharDimensions (GDI32.@) * GdiGetCharDimensions (GDI32.@)
* *