clutter/pick-stack: Move triangle check to else block

Just to improve the legibility of this part of the code. We
go either through box, or triangle, but never both.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1599>
This commit is contained in:
Georges Basile Stavracas Neto 2020-11-23 13:00:06 -03:00
parent d2feaa8d67
commit 3cf11f77b3

View File

@ -120,8 +120,6 @@ ray_intersects_input_region (Record *rec,
const graphene_ray_t *ray,
const graphene_point3d_t *point)
{
graphene_triangle_t t0, t1;
maybe_project_record (rec);
if (G_LIKELY (is_axis_aligned_2d_rectangle (rec->vertices)))
@ -132,6 +130,9 @@ ray_intersects_input_region (Record *rec,
return graphene_box_contains_point (&box, point) ||
graphene_ray_intersects_box (ray, &box);
}
else
{
graphene_triangle_t t0, t1;
/*
* Degrade the projected quad into the following triangles:
@ -155,13 +156,11 @@ ray_intersects_input_region (Record *rec,
&rec->vertices[2],
&rec->vertices[3]);
if (graphene_triangle_contains_point (&t0, point) ||
return graphene_triangle_contains_point (&t0, point) ||
graphene_triangle_contains_point (&t1, point) ||
graphene_ray_intersects_triangle (ray, &t0) ||
graphene_ray_intersects_triangle (ray, &t1))
return TRUE;
return FALSE;
graphene_ray_intersects_triangle (ray, &t1);
}
}
static gboolean