[gtk+/wip/baedert/gl: 59/86] gl renderer: Avoid consecutive opacity ops



commit cc18a2a96c375ccf1b83216ade46f3ffe125feeb
Author: Timm Bäder <mail baedert org>
Date:   Sun Dec 3 16:58:01 2017 +0100

    gl renderer: Avoid consecutive opacity ops

 gsk/gl/gskglrenderops.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index 2741320..3c97d94 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -207,13 +207,23 @@ ops_set_opacity (RenderOpBuilder *builder,
 {
   RenderOp op;
   float prev_opacity;
+  RenderOp *last_op;
 
   if (builder->current_opacity == opacity)
     return opacity;
 
-  op.op = OP_CHANGE_OPACITY;
-  op.opacity = opacity;
-  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_OPACITY)
+    {
+      last_op->opacity = opacity;
+    }
+  else
+    {
+      op.op = OP_CHANGE_OPACITY;
+      op.opacity = opacity;
+      g_array_append_val (builder->render_ops, op);
+    }
 
   prev_opacity = builder->current_opacity;
   builder->current_opacity = opacity;


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