Module: wine Branch: master Commit: 74e951a73ed74557407cde5da69d5aa724eae120 URL: https://source.winehq.org/git/wine.git/?a=commit;h=74e951a73ed74557407cde5da...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Dec 7 15:59:43 2021 +0300
dwrite: Add flag for cached advance presence.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dwrite/font.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index f6ac43e65ac..76abedde770 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -66,6 +66,7 @@ struct cache_entry struct cache_key key; float advance; unsigned int has_contours : 1; + unsigned int has_advance : 1; };
static struct cache_entry * fontface_get_cache_entry(struct dwrite_fontface *fontface, const struct cache_key *key) @@ -97,9 +98,6 @@ static float fontface_get_glyph_advance(struct dwrite_fontface *fontface, float { if (!(entry = calloc(1, sizeof(*entry)))) return 0.0f; - - entry->advance = font_funcs->get_glyph_advance(fontface->get_font_object(fontface), fontsize, glyph, mode, &value); - entry->has_contours = !!value; entry->key = key;
size = fontface_get_cache_entry_size(entry); @@ -123,6 +121,13 @@ static float fontface_get_glyph_advance(struct dwrite_fontface *fontface, float fontface->cache.size += size; }
+ if (!entry->has_advance) + { + entry->advance = font_funcs->get_glyph_advance(fontface->get_font_object(fontface), fontsize, glyph, mode, &value); + entry->has_contours = !!value; + entry->has_advance = 1; + } + *has_contours = entry->has_contours; return entry->advance; }