forked from AuroraMiddleware/gtk
gsk: Track disjointness of container nodes
This can be used to optimize some things in the GL renderer.
This commit is contained in:
parent
af20f7e9b5
commit
0eba21b2b5
@ -2576,6 +2576,7 @@ struct _GskContainerNode
|
||||
{
|
||||
GskRenderNode render_node;
|
||||
|
||||
gboolean disjoint;
|
||||
guint n_children;
|
||||
GskRenderNode **children;
|
||||
};
|
||||
@ -2724,6 +2725,7 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
self = gsk_render_node_alloc (GSK_CONTAINER_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
|
||||
self->disjoint = TRUE;
|
||||
self->n_children = n_children;
|
||||
|
||||
if (n_children == 0)
|
||||
@ -2743,6 +2745,7 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
for (guint i = 1; i < n_children; i++)
|
||||
{
|
||||
self->children[i] = gsk_render_node_ref (children[i]);
|
||||
self->disjoint &= !graphene_rect_intersection (&bounds, &(children[i]->bounds), NULL);
|
||||
graphene_rect_union (&bounds, &(children[i]->bounds), &bounds);
|
||||
node->prefers_high_depth |= gsk_render_node_prefers_high_depth (children[i]);
|
||||
}
|
||||
@ -2801,6 +2804,24 @@ gsk_container_node_get_children (const GskRenderNode *node,
|
||||
return self->children;
|
||||
}
|
||||
|
||||
/*< private>
|
||||
* gsk_container_node_is_disjoint:
|
||||
* @node: a container `GskRenderNode`
|
||||
*
|
||||
* Returns `TRUE` if it is known that the child nodes are not
|
||||
* overlapping. There is no guarantee that they do overlap
|
||||
* if this function return FALSE.
|
||||
*
|
||||
* Returns: `TRUE` if children don't overlap
|
||||
*/
|
||||
gboolean
|
||||
gsk_container_node_is_disjoint (const GskRenderNode *node)
|
||||
{
|
||||
const GskContainerNode *self = (const GskContainerNode *) node;
|
||||
|
||||
return self->disjoint;
|
||||
}
|
||||
|
||||
/*** GSK_TRANSFORM_NODE ***/
|
||||
|
||||
/**
|
||||
|
@ -113,6 +113,8 @@ void gsk_transform_node_get_translate (const GskRenderNode *no
|
||||
float *dy);
|
||||
gboolean gsk_render_node_prefers_high_depth (const GskRenderNode *node);
|
||||
|
||||
gboolean gsk_container_node_is_disjoint (const GskRenderNode *node);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user