Module: wine Branch: master Commit: f26b4a357560d7edeb7596091bf76ad03f8d7d2c URL: http://source.winehq.org/git/wine.git/?a=commit;h=f26b4a357560d7edeb7596091b...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Feb 9 17:11:20 2016 +0300
dwrite: Fetch all glyphs at once instead of locking/unlocking for every glyph.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dwrite/dwrite_private.h | 2 +- dlls/dwrite/font.c | 5 +---- dlls/dwrite/freetype.c | 31 +++++++++++++++++-------------- 3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index fd6d3c7..874f0bb 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -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; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index f350936..fd64d8b 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -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; }
diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c index 18b720a..753493d 100644 --- a/dlls/dwrite/freetype.c +++ b/dlls/dwrite/freetype.c @@ -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); - if (charmap == -1) - glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint); - else { - /* 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); + for (i = 0; i < count; i++) { + if (charmap == -1) + 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; + 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)