[gtk/wip/chergert/glproto: 312/526] avoid extra copy of rounded rect




commit d5bf090cd56f3a4262601f9d3f57922ff14e85fd
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jan 26 16:28:02 2021 -0800

    avoid extra copy of rounded rect

 gsk/next/gskglrenderjob.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index 56ed239d41..24c0190d14 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -586,16 +586,17 @@ static void
 gsk_gl_render_job_push_clip (GskGLRenderJob       *job,
                              const GskRoundedRect *rect)
 {
-  GskGLRenderClip clip;
+  GskGLRenderClip *clip;
 
   g_assert (job != NULL);
   g_assert (job->clip != NULL);
   g_assert (rect != NULL);
 
-  clip.rect = *rect;
-  clip.is_rectilinear = gsk_rounded_rect_is_rectilinear (rect);
+  g_array_set_size (job->clip, job->clip->len + 1);
 
-  g_array_append_val (job->clip, clip);
+  clip = &g_array_index (job->clip, GskGLRenderClip, job->clip->len - 1);
+  memcpy (&clip->rect, rect, sizeof *rect);
+  clip->is_rectilinear = gsk_rounded_rect_is_rectilinear (rect);
 }
 
 static void


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