[gtk+/wip/baedert/gl: 69/86] gl renderer: Add a helper function



commit 8bf8111d6c50200e318aac265793efe9fefd0606
Author: Timm Bäder <mail baedert org>
Date:   Wed Dec 6 16:07:18 2017 +0100

    gl renderer: Add a helper function
    
    We'll use this for the common case of a color matrix node inside a
    shadow node.

 gsk/gl/gskglrenderer.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 9a559b4..c07527c 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -144,6 +144,23 @@ sort_border_sides (const GdkRGBA *colors,
     }
 }
 
+static inline gboolean
+color_matrix_modifies_alpha (GskRenderNode *node)
+{
+  const graphene_matrix_t *matrix = gsk_color_matrix_node_peek_color_matrix (node);
+  const graphene_vec4_t *offset = gsk_color_matrix_node_peek_color_offset (node);
+  graphene_vec4_t row3;
+  graphene_vec4_t id_row3;
+
+  if (graphene_vec4_get_w (offset) != 0.0f)
+    return TRUE;
+
+  graphene_vec4_init (&id_row3, 0, 0, 0, 1);
+  graphene_matrix_get_row (matrix, 3, &row3);
+
+  return !graphene_vec4_equal (&id_row3, &row3);
+}
+
 static void gsk_gl_renderer_setup_render_mode (GskGLRenderer   *self);
 static void add_offscreen_ops                 (GskGLRenderer   *self,
                                                RenderOpBuilder *builder,


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