[gtk/glyphy2: 40/47] gsk/gl: dispatch text_node to legacy vs glyphy




commit 80bea8413fdba84f809102f9295da1eefc29b132
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 1fcadd8f1d..41d662d9ea 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"
@@ -2929,10 +2930,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);
@@ -3067,6 +3068,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]