mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 21:34:09 +00:00
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:
parent
d2feaa8d67
commit
3cf11f77b3
@ -120,8 +120,6 @@ ray_intersects_input_region (Record *rec,
|
|||||||
const graphene_ray_t *ray,
|
const graphene_ray_t *ray,
|
||||||
const graphene_point3d_t *point)
|
const graphene_point3d_t *point)
|
||||||
{
|
{
|
||||||
graphene_triangle_t t0, t1;
|
|
||||||
|
|
||||||
maybe_project_record (rec);
|
maybe_project_record (rec);
|
||||||
|
|
||||||
if (G_LIKELY (is_axis_aligned_2d_rectangle (rec->vertices)))
|
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) ||
|
return graphene_box_contains_point (&box, point) ||
|
||||||
graphene_ray_intersects_box (ray, &box);
|
graphene_ray_intersects_box (ray, &box);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphene_triangle_t t0, t1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Degrade the projected quad into the following triangles:
|
* Degrade the projected quad into the following triangles:
|
||||||
@ -155,13 +156,11 @@ ray_intersects_input_region (Record *rec,
|
|||||||
&rec->vertices[2],
|
&rec->vertices[2],
|
||||||
&rec->vertices[3]);
|
&rec->vertices[3]);
|
||||||
|
|
||||||
if (graphene_triangle_contains_point (&t0, point) ||
|
return graphene_triangle_contains_point (&t0, point) ||
|
||||||
graphene_triangle_contains_point (&t1, point) ||
|
graphene_triangle_contains_point (&t1, point) ||
|
||||||
graphene_ray_intersects_triangle (ray, &t0) ||
|
graphene_ray_intersects_triangle (ray, &t0) ||
|
||||||
graphene_ray_intersects_triangle (ray, &t1))
|
graphene_ray_intersects_triangle (ray, &t1);
|
||||||
return TRUE;
|
}
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user