[gtk/matthiasc/color-profiles: 2/4] gsk: Add hdr rendernode api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/color-profiles: 2/4] gsk: Add hdr rendernode api
- Date: Fri, 1 Oct 2021 21:05:48 +0000 (UTC)
commit edd93e694159a5e526ada53735c9c08dce1626fb
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.
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 3e65f05dba..e16507fa95 100644
--- a/gsk/gskrendernodeimpl.c
+++ b/gsk/gskrendernodeimpl.c
@@ -1569,6 +1569,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;
}
@@ -2739,11 +2741,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);
@@ -2974,6 +2978,8 @@ gsk_transform_node_new (GskRenderNode *child,
&child->bounds,
&node->bounds);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -3109,6 +3115,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;
}
@@ -3311,6 +3319,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;
}
@@ -3460,6 +3470,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;
}
@@ -3591,6 +3603,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;
}
@@ -3722,6 +3736,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;
}
@@ -3941,6 +3957,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;
}
@@ -4134,6 +4152,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;
}
@@ -4282,6 +4302,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;
}
@@ -4889,6 +4911,8 @@ gsk_blur_node_new (GskRenderNode *child,
- clip_radius,
- clip_radius);
+ node->is_hdr = gsk_render_node_is_hdr (child);
+
return node;
}
@@ -5011,6 +5035,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;
}
@@ -5175,7 +5201,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]