[gtk/wip/chergert/glyphy: 2/3] gsk/gl: dispatch text_node to legacy vs glyphy




commit 7ccf2fab94c2ed171ba4b7c4d291f4d3b5b3f787
Author: Christian Hergert <chergert redhat com>
Date:   Mon Mar 14 16:24:36 2022 -0700

    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 | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c
index afefe7a018..d02424f117 100644
--- a/gsk/gl/gskglrenderjob.c
+++ b/gsk/gl/gskglrenderjob.c
@@ -37,6 +37,7 @@
 #include "gskglcommandqueueprivate.h"
 #include "gskgldriverprivate.h"
 #include "gskglglyphlibraryprivate.h"
+#include "gskglglyphylibraryprivate.h"
 #include "gskgliconlibraryprivate.h"
 #include "gskglprogramprivate.h"
 #include "gskglrenderjobprivate.h"
@@ -2984,10 +2985,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);
@@ -3122,6 +3123,26 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob      *job,
   gsk_gl_render_job_end_draw (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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]