dwrite: Added a helper to avoid extra traces from one method calling another.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-04-20 12:50:08 +03:00 committed by Alexandre Julliard
parent 5b07cfc13e
commit 9bf9a9590a
1 changed files with 16 additions and 12 deletions

View File

@ -605,25 +605,31 @@ static HRESULT WINAPI dwritefontface_GetDesignGlyphMetrics(IDWriteFontFace4 *ifa
return S_OK;
}
static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace4 *iface, UINT32 const *codepoints,
UINT32 count, UINT16 *glyph_indices)
static HRESULT fontface_get_glyphs(struct dwrite_fontface *fontface, UINT32 const *codepoints,
UINT32 count, UINT16 *glyphs)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface);
TRACE("(%p)->(%p %u %p)\n", This, codepoints, count, glyph_indices);
if (!glyph_indices)
if (!glyphs)
return E_INVALIDARG;
if (!codepoints) {
memset(glyph_indices, 0, count*sizeof(UINT16));
memset(glyphs, 0, count * sizeof(*glyphs));
return E_INVALIDARG;
}
freetype_get_glyphs(iface, This->charmap, codepoints, count, glyph_indices);
freetype_get_glyphs(&fontface->IDWriteFontFace4_iface, fontface->charmap, codepoints, count, glyphs);
return S_OK;
}
static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace4 *iface, UINT32 const *codepoints,
UINT32 count, UINT16 *glyphs)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface);
TRACE("(%p)->(%p %u %p)\n", This, codepoints, count, glyphs);
return fontface_get_glyphs(This, codepoints, count, glyphs);
}
static HRESULT WINAPI dwritefontface_TryGetFontTable(IDWriteFontFace4 *iface, UINT32 table_tag,
const void **table_data, UINT32 *table_size, void **context, BOOL *exists)
{
@ -1161,13 +1167,11 @@ static BOOL WINAPI dwritefontface3_HasCharacter(IDWriteFontFace4 *iface, UINT32
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace4(iface);
UINT16 index;
HRESULT hr;
TRACE("(%p)->(0x%08x)\n", This, ch);
index = 0;
hr = IDWriteFontFace4_GetGlyphIndices(iface, &ch, 1, &index);
if (FAILED(hr))
if (FAILED(fontface_get_glyphs(This, &ch, 1, &index)))
return FALSE;
return index != 0;