[gtk/wip/matthiasc/gsk-hdr: 2/5] gsk: Add high depth rendernode api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/gsk-hdr: 2/5] gsk: Add high depth rendernode api
- Date: Wed, 6 Oct 2021 21:13:24 +0000 (UTC)
commit 164157fcc63fb34e0f1a7ff8602b336424df6f6c
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 1 16:23:12 2021 -0400
gsk: Add high depth rendernode api
Add private api to find out if the content
of a render node should be considered 'deep'.
The information is collected at creation time,
so there is no tree-walking involved when we
are using this information in the renderer.
Currently, this comes down to whether there are
any texture nodes with high depth textures in the subtree.
In the future, we may want to allow marking gradient
nodes in this way as well.
gsk/gskrendernode.c | 5 +++++
gsk/gskrendernodeimpl.c | 31 ++++++++++++++++++++++++++++++-
gsk/gskrendernodeprivate.h | 3 +++
3 files changed, 38 insertions(+), 1 deletion(-)
---
diff --git a/gsk/gskrendernode.c b/gsk/gskrendernode.c
index 9c4332fe01..6381d334d8 100644
--- a/gsk/gskrendernode.c
+++ b/gsk/gskrendernode.c
@@ -725,3 +725,8 @@ gsk_value_dup_render_node (const GValue *value)
return gsk_render_node_ref (value->data[0].v_pointer);
}
+gboolean
+gsk_render_node_prefers_high_depth (const GskRenderNode *node)
+{
+ return node->prefers_high_depth;
+}
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index fd2a9e5d44..1141d9a5cd 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -1560,6 +1560,8 @@ gsk_texture_node_new (GdkTexture *texture,
self->texture = g_object_ref (texture);
graphene_rect_init_from_rect (&node->bounds, bounds);
+ node->prefers_high_depth = gdk_texture_prefers_high_depth (texture);
+
return node;
}
@@ -2730,11 +2732,13 @@ gsk_container_node_new (GskRenderNode **children,
self->children[0] = gsk_render_node_ref (children[0]);
graphene_rect_init_from_rect (&bounds, &(children[0]->bounds));
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (children[0]);
for (guint i = 1; i < n_children; i++)
{
self->children[i] = gsk_render_node_ref (children[i]);
graphene_rect_union (&bounds, &(children[i]->bounds), &bounds);
+ node->prefers_high_depth |= gsk_render_node_prefers_high_depth (children[i]);
}
graphene_rect_init_from_rect (&node->bounds, &bounds);
@@ -2965,6 +2969,8 @@ gsk_transform_node_new (GskRenderNode *child,
&child->bounds,
&node->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -3100,6 +3106,8 @@ gsk_opacity_node_new (GskRenderNode *child,
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -3302,6 +3310,8 @@ gsk_color_matrix_node_new (GskRenderNode *child,
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -3451,6 +3461,8 @@ gsk_repeat_node_new (const graphene_rect_t *bounds,
else
graphene_rect_init_from_rect (&self->child_bounds, &child->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -3582,6 +3594,8 @@ gsk_clip_node_new (GskRenderNode *child,
graphene_rect_intersection (&self->clip, &child->bounds, &node->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -3713,6 +3727,8 @@ gsk_rounded_clip_node_new (GskRenderNode *child,
graphene_rect_intersection (&self->clip.bounds, &child->bounds, &node->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -3932,6 +3948,8 @@ gsk_shadow_node_new (GskRenderNode *child,
gsk_shadow_node_get_bounds (self, &node->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -4125,6 +4143,8 @@ gsk_blend_node_new (GskRenderNode *bottom,
graphene_rect_union (&bottom->bounds, &top->bounds, &node->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (bottom) || gsk_render_node_is_high_depth
(top);
+
return node;
}
@@ -4273,6 +4293,8 @@ gsk_cross_fade_node_new (GskRenderNode *start,
graphene_rect_union (&start->bounds, &end->bounds, &node->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (start) || gsk_render_node_is_high_depth
(end);
+
return node;
}
@@ -4864,6 +4886,8 @@ gsk_blur_node_new (GskRenderNode *child,
- clip_radius,
- clip_radius);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -4986,6 +5010,8 @@ gsk_debug_node_new (GskRenderNode *child,
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
+ node->prefers_high_depth = gsk_render_node_prefers_high_depth (child);
+
return node;
}
@@ -5150,7 +5176,10 @@ gsk_gl_shader_node_new (GskGLShader *shader,
{
self->children = g_malloc_n (n_children, sizeof (GskRenderNode *));
for (guint i = 0; i < n_children; i++)
- self->children[i] = gsk_render_node_ref (children[i]);
+ {
+ self->children[i] = gsk_render_node_ref (children[i]);
+ node->prefers_high_depth |= gsk_render_node_prefers_high_depth (children[i]);
+ }
}
return node;
diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h
index ac20813b65..cdb75afd2f 100644
--- a/gsk/gskrendernodeprivate.h
+++ b/gsk/gskrendernodeprivate.h
@@ -27,6 +27,8 @@ struct _GskRenderNode
gatomicrefcount ref_count;
graphene_rect_t bounds;
+
+ guint prefers_high_depth : 1;
};
struct _GskRenderNodeClass
@@ -109,6 +111,7 @@ GskRenderNode ** gsk_container_node_get_children (const GskRenderNode *no
void gsk_transform_node_get_translate (const GskRenderNode *node,
float *dx,
float *dy);
+gboolean gsk_render_node_prefers_high_depth (const GskRenderNode *node);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]