[gtk/wip/baedert/css-values: 5/13] gl renderer: Render simple border nodes in a simple way



commit 7dba3909e459e27e26f796e122e6ccdbd5b61f47
Author: Timm Bäder <mail baedert org>
Date:   Tue Jan 14 15:43:53 2020 +0100

    gl renderer: Render simple border nodes in a simple way
    
    Roughly 80% of the border nodes are just one color and have the same
    width on all sides, so we can draw them by uploading just one rect and
    not four.

 gsk/gl/gskglrenderer.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 91de970cac..7928da3096 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -761,6 +761,26 @@ render_border_node (GskGLRenderer   *self,
     float h;
   } sizes[4];
 
+  if (og_widths[0] == og_widths[1] &&
+      og_widths[0] == og_widths[2] &&
+      og_widths[0] == og_widths[3] &&
+      gdk_rgba_equal (&colors[0], &colors[1]) &&
+      gdk_rgba_equal (&colors[0], &colors[2]) &&
+      gdk_rgba_equal (&colors[0], &colors[3]))
+    {
+      OpShadow *op;
+
+      ops_set_program (builder, &self->inset_shadow_program);
+      op = ops_begin (builder, OP_CHANGE_INSET_SHADOW);
+      op->color = &colors[0];
+      op->outline = transform_rect (self, builder, rounded_outline);
+      op->spread = og_widths[0] * scale;
+      op->offset[0] = 0;
+      op->offset[1] = 0;
+
+      load_vertex_data (ops_draw (builder, NULL), node, builder);
+      return;
+    }
 
   for (i = 0; i < 4; i ++)
     widths[i] = og_widths[i];


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