[gtk/ngl-glyph-cache: 3/3] ngl: Improve the glyph front cache
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ngl-glyph-cache: 3/3] ngl: Improve the glyph front cache
- Date: Fri, 19 Mar 2021 18:32:36 +0000 (UTC)
commit b253aca883e886a5b5b8eaa770594ad1b77e9afe
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Mar 19 14:30:19 2021 -0400
ngl: Improve the glyph front cache
The effectiveness of the front cache is limited by
subpixel positioning making it very likely that we
will meet the same glyph in different x phases inside
a single line of text.
Factoring the xphase into the front cache key makes things
better. For the string eeeeeeeeeeeeeeeeeee
before: 0% front cache hits
after: >90% front cache hits
gsk/ngl/gsknglglyphlibraryprivate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gsk/ngl/gsknglglyphlibraryprivate.h b/gsk/ngl/gsknglglyphlibraryprivate.h
index f48ae6e585..c44068dd50 100644
--- a/gsk/ngl/gsknglglyphlibraryprivate.h
+++ b/gsk/ngl/gsknglglyphlibraryprivate.h
@@ -91,7 +91,7 @@ gsk_ngl_glyph_library_lookup_or_add (GskNglGlyphLibrary *self,
const GskNglGlyphValue **out_value)
{
GskNglTextureAtlasEntry *entry;
- guint front_index = key->glyph & 0xFF;
+ guint front_index = ((key->glyph << 2) | key->xshift) & 0xFF;
if (memcmp (key, &self->front[front_index], sizeof *key) == 0)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]