[gtk/better-glyph-caching] ngl: Improve glyph caching
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/better-glyph-caching] ngl: Improve glyph caching
- Date: Fri, 14 May 2021 02:02:55 +0000 (UTC)
commit bc088d668340b2b02cd4c97d158cd944dea238ea
Author: Matthias Clasen <mclasen redhat com>
Date: Thu May 13 21:35:26 2021 -0400
ngl: Improve glyph caching
Avoid creating duplicate cache entries with miniscule
scale differences. It does not cost us much to use a
slightly larger texture for a glyph.
gsk/ngl/gsknglrenderjob.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index d08d45a04f..0ebe3921cb 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -2837,6 +2837,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
guint i;
int yshift;
float ypos;
+ float scale;
if (num_glyphs == 0)
return;
@@ -2847,8 +2848,13 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job,
if (force_color || !gsk_text_node_has_color_glyphs (node))
rgba_to_half (color, c);
+ /* Avoid caching glyphs with miniscule scale differences */
+ scale = 1;
+ while (scale < text_scale)
+ scale *= 1.2;
+
lookup.font = (PangoFont *)font;
- lookup.scale = (guint) (text_scale * 1024);
+ lookup.scale = (guint) (scale * 1024);
yshift = compute_phase_and_pos (y, &ypos);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]