From 9f58740486c56cd12afd814330ee3548c584e6fb Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 14 Mar 2022 16:24:36 -0700 Subject: [PATCH] gsk/gl: Dispatch text_node to legacy vs glyphy If the text node has color glyphs, then we need to dispatch to the legacy form of rendering which uses FreeType/Cairo/etc to upload glyphs to a rendered glyph cache. Otherwise, we can dispatch to a new function which will eventually use Glyphy to shape to SDF content and upload to an alternate texture atlas. --- gsk/gl/gskglrenderjob.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c index 11d410a205..0f5d445c15 100644 --- a/gsk/gl/gskglrenderjob.c +++ b/gsk/gl/gskglrenderjob.c @@ -2959,10 +2959,10 @@ compute_phase_and_pos (float value, float *pos) } static inline void -gsk_gl_render_job_visit_text_node (GskGLRenderJob *job, - const GskRenderNode *node, - const GdkRGBA *color, - gboolean force_color) +gsk_gl_render_job_visit_text_node_legacy (GskGLRenderJob *job, + const GskRenderNode *node, + const GdkRGBA *color, + gboolean force_color) { const PangoFont *font = gsk_text_node_get_font (node); const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL); @@ -3098,6 +3098,26 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job, } } +static inline void +gsk_gl_render_job_visit_text_node_glyphy (GskGLRenderJob *job, + const GskRenderNode *node, + const GdkRGBA *color, + gboolean force_color) +{ +} + +static inline void +gsk_gl_render_job_visit_text_node (GskGLRenderJob *job, + const GskRenderNode *node, + const GdkRGBA *color, + gboolean force_color) +{ + if (!gsk_text_node_has_color_glyphs (node)) + gsk_gl_render_job_visit_text_node_glyphy (job, node, color, force_color); + else + gsk_gl_render_job_visit_text_node_legacy (job, node, color, force_color); +} + static inline void gsk_gl_render_job_visit_shadow_node (GskGLRenderJob *job, const GskRenderNode *node)