[mutter/wip/carlosg/honor-pick-vmethod: 2/2] clutter: Honor pick vmethod rectangle during region caching
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/honor-pick-vmethod: 2/2] clutter: Honor pick vmethod rectangle during region caching
- Date: Sat, 12 Feb 2022 13:27:04 +0000 (UTC)
commit 13c77c55e851949d5dcae8ef02d932626f5b9ab8
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Feb 11 14:40:21 2022 +0100
clutter: Honor pick vmethod rectangle during region caching
We retrieve the picked actor's allocation for figuring out the pick
cache clear area, but don't take into account that the pick vmethod
might have returned a different area for it.
Make sure to honor that rectangle, as that is what is accounted as
the input region.
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2135
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2283>
clutter/clutter/clutter-pick-stack.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/clutter/clutter/clutter-pick-stack.c b/clutter/clutter/clutter-pick-stack.c
index c7d8a71b63..db5c8d385d 100644
--- a/clutter/clutter/clutter-pick-stack.c
+++ b/clutter/clutter/clutter-pick-stack.c
@@ -453,8 +453,8 @@ get_verts_rectangle (graphene_point3d_t verts[4],
static void
calculate_clear_area (ClutterPickStack *pick_stack,
+ PickRecord *pick_rec,
int elem,
- ClutterActor *actor,
cairo_region_t **clear_area)
{
cairo_region_t *area = NULL;
@@ -462,7 +462,7 @@ calculate_clear_area (ClutterPickStack *pick_stack,
cairo_rectangle_int_t rect;
int i;
- clutter_actor_get_abs_allocation_vertices (actor,
+ clutter_actor_get_abs_allocation_vertices (pick_rec->actor,
(graphene_point3d_t *) &verts);
if (!get_verts_rectangle (verts, &rect))
{
@@ -471,6 +471,13 @@ calculate_clear_area (ClutterPickStack *pick_stack,
return;
}
+ rect.x += ceil (pick_rec->base.rect.x1);
+ rect.y += ceil (pick_rec->base.rect.y1);
+ rect.width =
+ MIN (rect.width, floor (pick_rec->base.rect.x2 - pick_rec->base.rect.x1));
+ rect.height =
+ MIN (rect.height, floor (pick_rec->base.rect.y2 - pick_rec->base.rect.y1));
+
area = cairo_region_create_rectangle (&rect);
for (i = elem + 1; i < pick_stack->vertices_stack->len; i++)
@@ -521,7 +528,7 @@ clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
ray_intersects_record (pick_stack, rec, point, ray))
{
if (clear_area)
- calculate_clear_area (pick_stack, i, rec->actor, clear_area);
+ calculate_clear_area (pick_stack, rec, i, clear_area);
return rec->actor;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]