gsk: Add a private getter for container children

No need to get them one-by-one, in our inner loop.
This commit is contained in:
Matthias Clasen 2021-07-24 09:49:09 -04:00
parent f88efb811b
commit 7fb1389648
3 changed files with 21 additions and 3 deletions

View File

@ -2780,6 +2780,17 @@ gsk_container_node_get_child (const GskRenderNode *node,
return self->children[idx];
}
GskRenderNode **
gsk_container_node_get_children (const GskRenderNode *node,
guint *n_children)
{
const GskContainerNode *self = (const GskContainerNode *) node;
*n_children = self->n_children;
return self->children;
}
/*** GSK_TRANSFORM_NODE ***/
/**

View File

@ -103,6 +103,10 @@ bool gsk_border_node_get_uniform_color (const GskRenderNode
void gsk_text_node_serialize_glyphs (GskRenderNode *self,
GString *str);
GskRenderNode ** gsk_container_node_get_children (const GskRenderNode *node,
guint *n_children);
G_END_DECLS
#endif /* __GSK_RENDER_NODE_PRIVATE_H__ */

View File

@ -3536,18 +3536,21 @@ gsk_ngl_render_job_visit_node (GskNglRenderJob *job,
case GSK_CONTAINER_NODE:
{
guint n_children = gsk_container_node_get_n_children (node);
GskRenderNode **children;
guint n_children;
children = gsk_container_node_get_children (node, &n_children);
for (guint i = 0; i < n_children; i++)
{
const GskRenderNode *child = gsk_container_node_get_child (node, i);
const GskRenderNode *child = children[i];
if (i + 1 < n_children &&
job->current_clip->is_fully_contained &&
gsk_render_node_get_node_type (child) == GSK_ROUNDED_CLIP_NODE)
{
const GskRenderNode *grandchild = gsk_rounded_clip_node_get_child (child);
const GskRenderNode *child2 = gsk_container_node_get_child (node, i + 1);
const GskRenderNode *child2 = children[i + 1];
if (gsk_render_node_get_node_type (grandchild) == GSK_COLOR_NODE &&
gsk_render_node_get_node_type (child2) == GSK_BORDER_NODE &&
gsk_border_node_get_uniform_color (child2) &&