gpu: Chceck if a container node is opaque as fallback
Sometimes container nodes contain lots of overlapping opaque items. In that case we can use the container node itself as the first node even though none of the children cover the whole paint area. The use case for this is a grid of cells like in a terminal where all the cells are opaque and we want to avoid drawing the background behind them.
This commit is contained in:
@@ -3036,26 +3036,41 @@ gsk_gpu_node_processor_add_first_container_node (GskGpuNodeProcessor *se
|
||||
GskRenderPassType pass_type,
|
||||
GskRenderNode *node)
|
||||
{
|
||||
gsize i, n;
|
||||
int i, n;
|
||||
|
||||
n = gsk_container_node_get_n_children (node);
|
||||
if (n == 0)
|
||||
return FALSE;
|
||||
|
||||
for (i = n - 1; ; i--)
|
||||
for (i = n; i-->0; )
|
||||
{
|
||||
if (gsk_gpu_node_processor_add_first_node (self,
|
||||
target,
|
||||
clip,
|
||||
pass_type,
|
||||
gsk_container_node_get_child (node, i)))
|
||||
break;
|
||||
|
||||
if (i == 0)
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = i + 1; i < n; i++)
|
||||
if (i < 0)
|
||||
{
|
||||
graphene_rect_t opaque, clip_bounds;
|
||||
|
||||
if (!gsk_render_node_get_opaque_rect (node, &opaque))
|
||||
return FALSE;
|
||||
|
||||
gsk_gpu_node_processor_get_clip_bounds (self, &clip_bounds);
|
||||
if (!gsk_rect_contains_rect (&opaque, &clip_bounds))
|
||||
return FALSE;
|
||||
|
||||
gsk_gpu_render_pass_begin_op (self->frame,
|
||||
target,
|
||||
clip,
|
||||
&GDK_RGBA_TRANSPARENT,
|
||||
pass_type);
|
||||
}
|
||||
|
||||
for (i++; i < n; i++)
|
||||
gsk_gpu_node_processor_add_node (self, gsk_container_node_get_child (node, i));
|
||||
|
||||
return TRUE;
|
||||
|
||||
Reference in New Issue
Block a user