Commit f26b4a35 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Fetch all glyphs at once instead of locking/unlocking for every glyph.

parent ce526d15
......@@ -212,7 +212,7 @@ extern BOOL freetype_is_monospaced(IDWriteFontFace2*) DECLSPEC_HIDDEN;
extern HRESULT freetype_get_glyphrun_outline(IDWriteFontFace2*,FLOAT,UINT16 const*,FLOAT const*, DWRITE_GLYPH_OFFSET const*,
UINT32,BOOL,IDWriteGeometrySink*) DECLSPEC_HIDDEN;
extern UINT16 freetype_get_glyphcount(IDWriteFontFace2*) DECLSPEC_HIDDEN;
extern UINT16 freetype_get_glyphindex(IDWriteFontFace2*,UINT32,INT) DECLSPEC_HIDDEN;
extern void freetype_get_glyphs(IDWriteFontFace2*,INT,UINT32 const*,UINT32,UINT16*) DECLSPEC_HIDDEN;
extern BOOL freetype_has_kerning_pairs(IDWriteFontFace2*) DECLSPEC_HIDDEN;
extern INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace2*,UINT16,UINT16) DECLSPEC_HIDDEN;
extern void freetype_get_glyph_bbox(struct dwrite_glyphbitmap*) DECLSPEC_HIDDEN;
......
......@@ -576,7 +576,6 @@ static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace2 *iface, UI
UINT32 count, UINT16 *glyph_indices)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace2(iface);
UINT32 i;
TRACE("(%p)->(%p %u %p)\n", This, codepoints, count, glyph_indices);
......@@ -588,9 +587,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace2 *iface, UI
return E_INVALIDARG;
}
for (i = 0; i < count; i++)
glyph_indices[i] = freetype_get_glyphindex(iface, codepoints[i], This->charmap);
freetype_get_glyphs(iface, This->charmap, codepoints, count, glyph_indices);
return S_OK;
}
......
......@@ -493,23 +493,25 @@ UINT16 freetype_get_glyphcount(IDWriteFontFace2 *fontface)
return count;
}
UINT16 freetype_get_glyphindex(IDWriteFontFace2 *fontface, UINT32 codepoint, INT charmap)
void freetype_get_glyphs(IDWriteFontFace2 *fontface, INT charmap, UINT32 const *codepoints, UINT32 count,
UINT16 *glyphs)
{
UINT16 glyph;
UINT32 i;
EnterCriticalSection(&freetype_cs);
for (i = 0; i < count; i++) {
if (charmap == -1)
glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint);
glyphs[i] = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoints[i]);
else {
UINT32 codepoint = codepoints[i];
/* special handling for symbol fonts */
if (codepoint < 0x100) codepoint += 0xf000;
glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint);
if (!glyph)
glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint - 0xf000);
glyphs[i] = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint);
if (!glyphs[i])
glyphs[i] = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint - 0xf000);
}
}
LeaveCriticalSection(&freetype_cs);
return glyph;
}
BOOL freetype_has_kerning_pairs(IDWriteFontFace2 *fontface)
......@@ -836,9 +838,10 @@ UINT16 freetype_get_glyphcount(IDWriteFontFace2 *fontface)
return 0;
}
UINT16 freetype_get_glyphindex(IDWriteFontFace2 *fontface, UINT32 codepoint, INT charmap)
void freetype_get_glyphs(IDWriteFontFace2 *fontface, INT charmap, UINT32 const *codepoints, UINT32 count,
UINT16 *glyphs)
{
return 0;
memset(glyphs, 0, count * sizeof(*glyphs));
}
BOOL freetype_has_kerning_pairs(IDWriteFontFace2 *fontface)
......
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