[gtk+/wip/baedert/gl: 60/94] gl renderer: Remove consecutive clip ops



commit d87c8c378255261c4d31dd5d82ea89cb10feff16
Author: Timm Bäder <mail baedert org>
Date:   Sat Dec 2 11:02:31 2017 +0100

    gl renderer: Remove consecutive clip ops

 gsk/gl/gskglrenderops.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index 8fe9e90..2741320 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -62,12 +62,23 @@ GskRoundedRect
 ops_set_clip (RenderOpBuilder      *builder,
               const GskRoundedRect *clip)
 {
-  RenderOp op;
+  RenderOp *last_op;
   GskRoundedRect prev_clip;
 
-  op.op = OP_CHANGE_CLIP;
-  op.clip = *clip;
-  g_array_append_val (builder->render_ops, op);
+  last_op = &g_array_index (builder->render_ops, RenderOp, builder->render_ops->len - 1);
+
+  if (last_op->op == OP_CHANGE_CLIP)
+    {
+      last_op->clip = *clip;
+    }
+  else
+    {
+      RenderOp op;
+
+      op.op = OP_CHANGE_CLIP;
+      op.clip = *clip;
+      g_array_append_val (builder->render_ops, op);
+    }
 
   if (builder->current_program != NULL)
     builder->program_state[builder->current_program->index].clip = *clip;


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