[gtk/wip/chergert/glproto: 361/493] avoid second copy




commit f8bcc8f2ce5ebc88c5d37f0dd2b6c25c27c02fe4
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 2 22:49:03 2021 -0800

    avoid second copy

 gsk/next/gskglcommandqueue.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 2dbb85d8f3..67a34b8b74 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -400,17 +400,18 @@ gsk_gl_command_queue_uniform_snapshot_cb (const GskGLUniformInfo *info,
                                           gpointer                user_data)
 {
   GskGLCommandQueue *self = user_data;
-  GskGLCommandUniform uniform;
+  GskGLCommandUniform *uniform;
 
   g_assert (info != NULL);
   g_assert (info->initial == FALSE);
   g_assert (info->changed == TRUE);
   g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
 
-  uniform.location = location;
-  uniform.info = *info;
+  g_array_set_size (self->batch_uniforms, self->batch_uniforms->len+1);
 
-  g_array_append_val (self->batch_uniforms, uniform);
+  uniform = &g_array_index (self->batch_uniforms, GskGLCommandUniform, self->batch_uniforms->len-1);
+  uniform->location = location;
+  uniform->info = *info;
 }
 
 void


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