[gtk/glshader-paintable: 5/8] snapshot: Drop the varargs versions of push_gl_shader()




commit 810e9c238eb6bbd6f24bf1f4c2468930fbb77bbe
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Sep 25 16:51:46 2020 +0200

    snapshot: Drop the varargs versions of push_gl_shader()
    
    We can now just use gsk_gl_shader_format_args() directly, relying
    on the transfer-full of the shader args argument.

 demos/gtk-demo/gtkshaderbin.c        | 11 ++++---
 demos/gtk-demo/gtkshaderstack.c      | 14 +++++----
 docs/reference/gtk/gtk4-sections.txt |  2 --
 gtk/gtksnapshot.c                    | 61 ------------------------------------
 gtk/gtksnapshot.h                    | 12 -------
 5 files changed, 14 insertions(+), 86 deletions(-)
---
diff --git a/demos/gtk-demo/gtkshaderbin.c b/demos/gtk-demo/gtkshaderbin.c
index c617984b7e..c728458090 100644
--- a/demos/gtk-demo/gtkshaderbin.c
+++ b/demos/gtk-demo/gtkshaderbin.c
@@ -198,11 +198,12 @@ gtk_shader_bin_snapshot (GtkWidget   *widget,
 
       if (self->active_shader->compiled_ok)
         {
-          gtk_snapshot_push_gl_shader_v (snapshot, self->active_shader->shader,
-                                         &GRAPHENE_RECT_INIT(0, 0, width, height),
-                                         1,
-                                         "u_time", &self->time,
-                                         NULL);
+          gtk_snapshot_push_gl_shader (snapshot, self->active_shader->shader,
+                                       &GRAPHENE_RECT_INIT(0, 0, width, height),
+                                       gsk_gl_shader_format_args (self->active_shader->shader,
+                                                                  "u_time", &self->time,
+                                                                  NULL),
+                                       1);
           gtk_widget_snapshot_child (widget, self->child, snapshot);
           gtk_snapshot_pop (snapshot);
 
diff --git a/demos/gtk-demo/gtkshaderstack.c b/demos/gtk-demo/gtkshaderstack.c
index d83e115764..32dbc1e658 100644
--- a/demos/gtk-demo/gtkshaderstack.c
+++ b/demos/gtk-demo/gtkshaderstack.c
@@ -241,12 +241,14 @@ gtk_shader_stack_snapshot (GtkWidget   *widget,
       if (gsk_gl_shader_try_compile_for (self->shader,
                                          renderer, NULL))
         {
-          gtk_snapshot_push_gl_shader_v (snapshot,
-                                         self->shader,
-                                         &GRAPHENE_RECT_INIT(0, 0, width, height),
-                                         2,
-                                         "progress", &progress,
-                                         NULL);
+          gtk_snapshot_push_gl_shader (snapshot,
+                                       self->shader,
+                                       &GRAPHENE_RECT_INIT(0, 0, width, height),
+                                       gsk_gl_shader_format_args (self->shader,
+                                                                  "progress", &progress,
+                                                                  NULL),
+                                       2);
+
           gtk_widget_snapshot_child (widget, current, snapshot);
           gtk_snapshot_pop (snapshot); /* current child */
           gtk_widget_snapshot_child (widget, next, snapshot);
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 1684163244..5706c518f3 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4312,8 +4312,6 @@ gtk_snapshot_push_blur
 gtk_snapshot_push_shadow
 gtk_snapshot_push_debug
 gtk_snapshot_push_gl_shader
-gtk_snapshot_push_gl_shader_v
-gtk_snapshot_push_gl_shader_va
 gtk_snapshot_pop
 gtk_snapshot_save
 gtk_snapshot_restore
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 3e4dd5bf38..1f5af89655 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -933,67 +933,6 @@ gtk_snapshot_push_gl_shader (GtkSnapshot           *snapshot,
     }
 }
 
-
-/**
- * gtk_snapshot_push_gl_shader_va:
- * @snapshot: a #GtkSnapshot
- * @shader: The code to run
- * @bounds: the rectangle to render into
- * @n_children: The number of extra nodes given as argument to the shader as textures.
- * @uniforms: Name-Value pairs for the uniforms of @shader, ending with a %NULL name, all values are passed 
by reference.
- *
- * Renders a rectangle with output from a GLSL shader. This is the same as
- * gtk_snapshot_push_gl_shader() but it takes a var-arg list of uniform variables
- * to make it easier to use from C. See gtk_snapshot_push_gl_shader() for details
- * of the behaviour not related to the varargs.
- *
- * The @uniforms argument is a %NULL separated list of Name-Value pairs for the
- * uniforms of @shader. All the values are passed by reference, so you will need
- * to pass a pointer to a float, etc.
- */
-void
-gtk_snapshot_push_gl_shader_va (GtkSnapshot           *snapshot,
-                                GskGLShader           *shader,
-                                const graphene_rect_t *bounds,
-                                int                    n_children,
-                                va_list                uniforms)
-{
-  GBytes *args = gsk_gl_shader_format_args_va (shader, uniforms);
-  gtk_snapshot_push_gl_shader (snapshot, shader, bounds,
-                               args, n_children);
-}
-
-/**
- * gtk_snapshot_push_gl_shader_v:
- * @snapshot: a #GtkSnapshot
- * @shader: The code to run
- * @bounds: the rectangle to render into
- * @n_children: The number of extra nodes given as argument to the shader as textures.
- * @...: Name-Value pairs for the uniforms of @shader, ending with a %NULL name, all values are passed by 
reference.
- *
- * Renders a rectangle with output from a GLSL shader. This is the same as
- * gtk_snapshot_push_gl_shader() but it takes a var-arg list of uniform variables
- * to make it easier to use from C. See gtk_snapshot_push_gl_shader() for details
- * of the behaviour not related to the varargs.
- *
- * The @... argument is a %NULL separated list of Name-Value pairs for the
- * uniforms of @shader. All the values are passed by reference, so you will
- * need to pass a pointer to a float, etc.
- */
-void
-gtk_snapshot_push_gl_shader_v (GtkSnapshot           *snapshot,
-                               GskGLShader           *shader,
-                               const graphene_rect_t *bounds,
-                               int                    n_children,
-                               ...)
-{
-  va_list args;
-
-  va_start (args, n_children);
-  gtk_snapshot_push_gl_shader_va (snapshot, shader, bounds, n_children, args);
-  va_end (args);
-}
-
 static GskRenderNode *
 gtk_snapshot_collect_rounded_clip (GtkSnapshot      *snapshot,
                                    GtkSnapshotState *state,
diff --git a/gtk/gtksnapshot.h b/gtk/gtksnapshot.h
index 6936eb3e67..de8f554159 100644
--- a/gtk/gtksnapshot.h
+++ b/gtk/gtksnapshot.h
@@ -105,18 +105,6 @@ void            gtk_snapshot_push_gl_shader             (GtkSnapshot
                                                          GBytes                 *take_args,
                                                          int                     n_children);
 GDK_AVAILABLE_IN_ALL
-void            gtk_snapshot_push_gl_shader_v           (GtkSnapshot            *snapshot,
-                                                         GskGLShader            *shader,
-                                                         const graphene_rect_t  *bounds,
-                                                         int                     n_children,
-                                                         ...) G_GNUC_NULL_TERMINATED;
-GDK_AVAILABLE_IN_ALL
-void            gtk_snapshot_push_gl_shader_va          (GtkSnapshot            *snapshot,
-                                                         GskGLShader            *shader,
-                                                         const graphene_rect_t  *bounds,
-                                                         int                     n_children,
-                                                         va_list                 uniforms);
-GDK_AVAILABLE_IN_ALL
 void            gtk_snapshot_pop                        (GtkSnapshot            *snapshot);
 
 GDK_AVAILABLE_IN_ALL


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