[gtk+/wip/baedert/gl: 170/177] gl renderer: Avoid consecutive opacity ops



commit e8fe28a4b51b0e17166fd637a6c795e3b1b2a13d
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 a752b77..4c6df91 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]