[gtk/transparent-optimizations: 2/3] ngl: Do nothing for transparent color nodes




commit fd48afb77d27c6d0402f7938e73b4315cb8842c3
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jul 15 13:16:37 2021 -0400

    ngl: Do nothing for transparent color nodes
    
    No need to send commands to the GPU to render transparency.

 gsk/ngl/gsknglrenderjob.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index b876e6e248..8785766612 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -1373,11 +1373,16 @@ static inline void
 gsk_ngl_render_job_visit_color_node (GskNglRenderJob     *job,
                                      const GskRenderNode *node)
 {
+  const GdkRGBA *rgba;
   guint16 color[4];
   GskNglProgram *program;
   GskNglCommandBatch *batch;
 
-  rgba_to_half (gsk_color_node_get_color (node), color);
+  rgba = gsk_color_node_get_color (node);
+  if (gdk_rgba_is_clear (rgba))
+    return;
+
+  rgba_to_half (rgba, color);
 
   /* Avoid switching away from the coloring program for
    * rendering a solid color.


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