offload: Fix our tree walk

We were not finding an overlaid spinner, since it is implemented
as a texture in a (most of the time) non-affine transform, and
we were aborting our treewalk when we see such transforms.

Instead, don't abort the walk on any transforms, but check if we
are in an affine context before deciding to offload a subsurface.
This commit is contained in:
Matthias Clasen 2024-02-09 12:33:37 -05:00
parent 46cb0c5fc8
commit be2dcdd897

View File

@ -141,16 +141,8 @@ transform_bounds (GskOffload *self,
graphene_rect_t *rect)
{
GskTransform *t = self->transforms ? self->transforms->data : NULL;
float sx, sy, dx, dy;
g_assert (gsk_transform_get_category (t) >= GSK_TRANSFORM_CATEGORY_2D_AFFINE);
gsk_transform_to_affine (t, &sx, &sy, &dx, &dy);
rect->origin.x = bounds->origin.x * sx + dx;
rect->origin.y = bounds->origin.y * sy + dy;
rect->size.width = bounds->size.width * sx;
rect->size.height = bounds->size.height * sy;
gsk_transform_transform_bounds (t, bounds, rect);
}
static inline void
@ -480,35 +472,11 @@ complex_clip:
break;
case GSK_TRANSFORM_NODE:
{
GskTransform *transform = gsk_transform_node_get_transform (node);
const GskTransformCategory category = gsk_transform_get_category (transform);
switch (category)
{
case GSK_TRANSFORM_CATEGORY_IDENTITY:
visit_node (self, gsk_transform_node_get_child (node));
break;
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
push_transform (self, transform);
push_transform (self, gsk_transform_node_get_transform (node));
visit_node (self, gsk_transform_node_get_child (node));
pop_transform (self);
break;
case GSK_TRANSFORM_CATEGORY_2D:
case GSK_TRANSFORM_CATEGORY_3D:
case GSK_TRANSFORM_CATEGORY_ANY:
case GSK_TRANSFORM_CATEGORY_UNKNOWN:
break;
default:
g_assert_not_reached ();
}
}
break;
case GSK_CONTAINER_NODE:
for (gsize i = 0; i < gsk_container_node_get_n_children (node); i++)
visit_node (self, gsk_container_node_get_child (node, i));
@ -536,6 +504,13 @@ complex_clip:
"Can't offload subsurface %p: clipped",
subsurface);
}
else if (self->transforms &&
gsk_transform_get_category ((GskTransform *)self->transforms->data) < GSK_TRANSFORM_CATEGORY_2D_AFFINE)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"Can't offload subsurface %p: non-affine transform",
subsurface);
}
else
{
info->texture = find_texture_to_attach (self, subsurface, gsk_subsurface_node_get_child (node));