gpu: Consult scissor for clip bounds

When querying clip bounds, also check the scissor rect, because
sometimes that one is tighter than the clip bounds, because the clip
bounds need to track some larger rounded corners.

Makes a few tests harder to break.
This commit is contained in:
Benjamin Otte 2024-08-07 19:26:23 +02:00
parent 5976debfcd
commit 852ecf7c20

View File

@ -531,14 +531,25 @@ static void
gsk_gpu_node_processor_get_clip_bounds (GskGpuNodeProcessor *self,
graphene_rect_t *out_bounds)
{
graphene_rect_offset_r (&self->clip.rect.bounds,
- self->offset.x,
- self->offset.y,
out_bounds);
/* FIXME: We could try the scissor rect here.
* But how often is that smaller than the clip bounds?
*/
graphene_rect_t scissor;
if (gsk_gpu_node_processor_rect_device_to_clip (self,
&GSK_RECT_INIT_CAIRO (&self->scissor),
&scissor))
{
if (!gsk_rect_intersection (&scissor, &self->clip.rect.bounds, out_bounds))
{
g_warning ("Clipping is broken, everything is clipped, but we didn't early-exit.\n");
*out_bounds = self->clip.rect.bounds;
}
}
else
{
*out_bounds = self->clip.rect.bounds;
}
out_bounds->origin.x -= self->offset.x;
out_bounds->origin.y -= self->offset.y;
}
static gboolean G_GNUC_WARN_UNUSED_RESULT