[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 01:39:59 +0000 (UTC)
commit 2a3cec1993ef68ace62cce57e7f098d82dda142a
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 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index d08d45a04f..efbdb5a681 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);
@@ -3901,7 +3907,7 @@ gsk_ngl_render_job_render (GskNglRenderJob *job,
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Build GL command queue", "");
-#if 0
+#if 1
/* At this point the atlases have uploaded content while we processed
* nodes but have not necessarily been used by the commands in the queue.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]