[gtk/ngl-rect-borders: 7/8] ngl: Render simple borders simply
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ngl-rect-borders: 7/8] ngl: Render simple borders simply
- Date: Tue, 9 Mar 2021 17:15:41 +0000 (UTC)
commit 09af40faeb21e23f50b3227f711f11e77b3a0632
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 8 21:37:28 2021 -0500
ngl: Render simple borders simply
Use 4 color commands for uniform, rectilinear
borders. Most of our borders are rounded with
Adwaita, but there are still some of these.
gsk/ngl/gsknglrenderjob.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
---
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index 9eb880b842..93ca180133 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -1683,6 +1683,48 @@ sort_border_sides (const GdkRGBA *colors,
}
}
+static inline void
+gsk_ngl_render_job_visit_rect_border_node (GskNglRenderJob *job,
+ const GskRenderNode *node)
+{
+ const GdkRGBA *colors = gsk_border_node_get_colors (node);
+ const float *widths = gsk_border_node_get_widths (node);
+ const graphene_point_t *origin = &node->bounds.origin;
+ const graphene_size_t *size = &node->bounds.size;
+
+ gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, color));
+
+ gsk_ngl_program_set_uniform_color (job->current_program,
+ UNIFORM_COLOR_COLOR, 0,
+ &colors[0]);
+
+ gsk_ngl_render_job_draw_rect (job,
+ &GRAPHENE_RECT_INIT (origin->x,
+ origin->y,
+ size->width - widths[1],
+ widths[0]));
+
+ gsk_ngl_render_job_draw_rect (job,
+ &GRAPHENE_RECT_INIT (origin->x + size->width - widths[1],
+ origin->y,
+ widths[1],
+ size->height - widths[2]));
+
+ gsk_ngl_render_job_draw_rect (job,
+ &GRAPHENE_RECT_INIT (origin->x + widths[3],
+ origin->y + size->height - widths[2],
+ size->width - widths[1],
+ widths[2]));
+
+ gsk_ngl_render_job_draw_rect (job,
+ &GRAPHENE_RECT_INIT (origin->x,
+ origin->y + widths[0],
+ widths[3],
+ size->height - widths[0]));
+
+ gsk_ngl_render_job_end_draw (job);
+}
+
static inline void
gsk_ngl_render_job_visit_uniform_border_node (GskNglRenderJob *job,
const GskRenderNode *node)
@@ -3414,7 +3456,10 @@ gsk_ngl_render_job_visit_node (GskNglRenderJob *job,
break;
case GSK_BORDER_NODE:
- if (gsk_border_node_get_uniform (node))
+ if (gsk_border_node_get_uniform_color (node) &&
+ gsk_rounded_rect_is_rectilinear (gsk_border_node_get_outline (node)))
+ gsk_ngl_render_job_visit_rect_border_node (job, node);
+ else if (gsk_border_node_get_uniform (node))
gsk_ngl_render_job_visit_uniform_border_node (job, node);
else
gsk_ngl_render_job_visit_border_node (job, node);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]