[gtk] snapshot: Repeat color nodes by creating a larger color node
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] snapshot: Repeat color nodes by creating a larger color node
- Date: Tue, 7 Jan 2020 16:39:33 +0000 (UTC)
commit 4788f8884005158e8c1328d7eced1b61ba0302e3
Author: Timm Bäder <mail baedert org>
Date: Thu Dec 19 09:15:13 2019 +0100
snapshot: Repeat color nodes by creating a larger color node
gtk/gtksnapshot.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index a7f55e6bbb..c87ba493f9 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -547,13 +547,25 @@ gtk_snapshot_collect_repeat (GtkSnapshot *snapshot,
guint n_nodes)
{
GskRenderNode *node, *repeat_node;
- graphene_rect_t *bounds = &state->data.repeat.bounds;
- graphene_rect_t *child_bounds = &state->data.repeat.child_bounds;
+ const graphene_rect_t *bounds = &state->data.repeat.bounds;
+ const graphene_rect_t *child_bounds = &state->data.repeat.child_bounds;
node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes);
if (node == NULL)
return NULL;
+ if (gsk_render_node_get_node_type (node) == GSK_COLOR_NODE &&
+ graphene_rect_equal (child_bounds, &node->bounds))
+ {
+ /* Repeating a color node entirely is pretty easy by just increasing
+ * the size of the color node. */
+ GskRenderNode *color_node = gsk_color_node_new (gsk_color_node_peek_color (node), bounds);
+
+ gsk_render_node_unref (node);
+
+ return color_node;
+ }
+
repeat_node = gsk_repeat_node_new (bounds,
node,
child_bounds->size.width > 0 ? child_bounds : NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]