[gtk/matthiasc/color-profiles: 122/140] gsk: Add hdr rendernode api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/color-profiles: 122/140] gsk: Add hdr rendernode api
- Date: Sun, 3 Oct 2021 04:45:13 +0000 (UTC)
commit 917c8f1e2c687437e8102e4a76cbaefcb85af1cc
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 1 16:23:12 2021 -0400
gsk: Add hdr rendernode api
Add private api to find out if the content
of a render node should be considered HDR.
Currently, this comes down to whether there are
any texture nodes with HDR textures in the subtree.
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..175b9399ad 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_is_hdr (const GskRenderNode *node)
+{
+ return node->is_hdr;
+}
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c
index 36d6105cc6..c55c7ac951 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -1588,6 +1588,8 @@ gsk_texture_node_new (GdkTexture *texture,
self->texture = g_object_ref (texture);
graphene_rect_init_from_rect (&node->bounds, bounds);
+ node->is_hdr = gdk_texture_is_hdr (texture);
+
return node;
}
@@ -2758,11 +2760,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->is_hdr = gsk_render_node_is_hdr (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->is_hdr |= gsk_render_node_is_hdr (children[i]);
}
graphene_rect_init_from_rect (&node->bounds, &bounds);
@@ -2993,6 +2997,8 @@ gsk_transform_node_new (GskRenderNode *child,
&child->bounds,
&node->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -3128,6 +3134,8 @@ gsk_opacity_node_new (GskRenderNode *child,
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -3330,6 +3338,8 @@ gsk_color_matrix_node_new (GskRenderNode *child,
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -3479,6 +3489,8 @@ gsk_repeat_node_new (const graphene_rect_t *bounds,
else
graphene_rect_init_from_rect (&self->child_bounds, &child->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -3610,6 +3622,8 @@ gsk_clip_node_new (GskRenderNode *child,
graphene_rect_intersection (&self->clip, &child->bounds, &node->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -3741,6 +3755,8 @@ gsk_rounded_clip_node_new (GskRenderNode *child,
graphene_rect_intersection (&self->clip.bounds, &child->bounds, &node->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -3960,6 +3976,8 @@ gsk_shadow_node_new (GskRenderNode *child,
gsk_shadow_node_get_bounds (self, &node->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -4153,6 +4171,8 @@ gsk_blend_node_new (GskRenderNode *bottom,
graphene_rect_union (&bottom->bounds, &top->bounds, &node->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (bottom) || gsk_render_node_is_hdr (top);
+
return node;
}
@@ -4301,6 +4321,8 @@ gsk_cross_fade_node_new (GskRenderNode *start,
graphene_rect_union (&start->bounds, &end->bounds, &node->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (start) || gsk_render_node_is_hdr (end);
+
return node;
}
@@ -4908,6 +4930,8 @@ gsk_blur_node_new (GskRenderNode *child,
- clip_radius,
- clip_radius);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -5030,6 +5054,8 @@ gsk_debug_node_new (GskRenderNode *child,
graphene_rect_init_from_rect (&node->bounds, &child->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -5194,7 +5220,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->is_hdr |= gsk_render_node_is_hdr (children[i]);
+ }
}
return node;
diff --git a/gsk/gskrendernodeprivate.h b/gsk/gskrendernodeprivate.h
index ac20813b65..9c9bb5b372 100644
--- a/gsk/gskrendernodeprivate.h
+++ b/gsk/gskrendernodeprivate.h
@@ -27,6 +27,8 @@ struct _GskRenderNode
gatomicrefcount ref_count;
graphene_rect_t bounds;
+
+ guint is_hdr : 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_is_hdr (const GskRenderNode *node);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]