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