From: Timm Bäder Date: Tue, 14 Jan 2020 14:43:53 +0000 (+0100) Subject: gl renderer: Render simple border nodes in a simple way X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~278 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3091679ffa935720d3a2b45f881aa845b6c04167;p=gtk4.git 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. --- 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];