[gtk/fixup-shadernode-constructor] Fix up preconditions of gsk_gl_shader_node_new




commit bf852bea248b8515abbb5d8b8bfe79c949d2f720
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Mar 3 22:39:02 2022 -0700

    Fix up preconditions of gsk_gl_shader_node_new
    
    These were not quite right, and implied that args
    may be NULL, when it really can't.
    
    Fixes: #4739

 gsk/gskrendernodeimpl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index dca0bbe585..384de83bad 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -5130,10 +5130,10 @@ gsk_gl_shader_node_diff (GskRenderNode  *node1,
  * @shader: the `GskGLShader`
  * @bounds: the rectangle to render the shader into
  * @args: Arguments for the uniforms
- * @children: (array length=n_children): array of child nodes, these will
- *     be rendered to textures and used as input.
+ * @children: (nullable) (array length=n_children): array of child nodes,
+ *   these will be rendered to textures and used as input.
  * @n_children: Length of @children (currenly the GL backend supports
- *     up to 4 children)
+ *   up to 4 children)
  *
  * Creates a `GskRenderNode` that will render the given @shader into the
  * area given by @bounds.
@@ -5167,10 +5167,10 @@ gsk_gl_shader_node_new (GskGLShader           *shader,
 
   g_return_val_if_fail (GSK_IS_GL_SHADER (shader), NULL);
   g_return_val_if_fail (bounds != NULL, NULL);
-  g_return_val_if_fail ((args == NULL && gsk_gl_shader_get_n_uniforms (shader) == 0) ||
-                        (args != NULL && g_bytes_get_size (args) == gsk_gl_shader_get_args_size (shader)), 
NULL);
+  g_return_val_if_fail (args != NULL, NULL);
+  g_return_val_if_fail (g_bytes_get_size (args) == gsk_gl_shader_get_args_size (shader), NULL);
   g_return_val_if_fail ((children == NULL && n_children == 0) ||
-                        (children != NULL && n_children == gsk_gl_shader_get_n_textures (shader)), NULL);
+                        (n_children == gsk_gl_shader_get_n_textures (shader)), NULL);
 
   self = gsk_render_node_alloc (GSK_GL_SHADER_NODE);
   node = (GskRenderNode *) self;


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