clutter: Also log overlap regions in ClutterPickContext/Stack
These may be used for optimizations once we find the pick actor, so picking can be avoided in areas we know didn't cross into other actors. Nothing makes use of it yet though, just log these so far. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
This commit is contained in:
parent
eda7588190
commit
5428b96f1b
@ -3960,7 +3960,10 @@ clutter_actor_pick (ClutterActor *actor,
|
||||
|
||||
clutter_paint_volume_to_box (&priv->last_paint_volume, &box);
|
||||
if (!clutter_pick_context_intersects_box (pick_context, &box))
|
||||
goto out;
|
||||
{
|
||||
clutter_pick_context_log_overlap (pick_context, actor);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->enable_model_view_transform)
|
||||
|
@ -118,6 +118,20 @@ clutter_pick_context_log_pick (ClutterPickContext *pick_context,
|
||||
clutter_pick_stack_log_pick (pick_context->pick_stack, box, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_pick_context_log_overlap:
|
||||
* @pick_context: a #ClutterPickContext
|
||||
* @actor: a #ClutterActor
|
||||
*
|
||||
* Logs an overlapping actor into the pick stack.
|
||||
*/
|
||||
void
|
||||
clutter_pick_context_log_overlap (ClutterPickContext *pick_context,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
clutter_pick_stack_log_overlap (pick_context->pick_stack, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_pick_context_push_clip:
|
||||
* @pick_context: a #ClutterPickContext
|
||||
|
@ -50,6 +50,9 @@ CLUTTER_EXPORT
|
||||
void clutter_pick_context_log_pick (ClutterPickContext *pick_context,
|
||||
const ClutterActorBox *box,
|
||||
ClutterActor *actor);
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_log_overlap (ClutterPickContext *pick_context,
|
||||
ClutterActor *actor);
|
||||
|
||||
CLUTTER_EXPORT
|
||||
void clutter_pick_context_push_clip (ClutterPickContext *pick_context,
|
||||
|
@ -42,6 +42,8 @@ void clutter_pick_stack_seal (ClutterPickStack *pick_stack);
|
||||
void clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
|
||||
const ClutterActorBox *box,
|
||||
ClutterActor *actor);
|
||||
void clutter_pick_stack_log_overlap (ClutterPickStack *pick_stack,
|
||||
ClutterActor *actor);
|
||||
|
||||
void clutter_pick_stack_push_clip (ClutterPickStack *pick_stack,
|
||||
const ClutterActorBox *box);
|
||||
|
@ -32,6 +32,7 @@ typedef struct
|
||||
Record base;
|
||||
ClutterActor *actor;
|
||||
int clip_index;
|
||||
gboolean is_overlap;
|
||||
} PickRecord;
|
||||
|
||||
typedef struct
|
||||
@ -342,6 +343,7 @@ clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
|
||||
|
||||
g_assert (!pick_stack->sealed);
|
||||
|
||||
rec.is_overlap = FALSE;
|
||||
rec.actor = actor;
|
||||
rec.clip_index = pick_stack->current_clip_stack_top;
|
||||
rec.base.rect = *box;
|
||||
@ -352,6 +354,21 @@ clutter_pick_stack_log_pick (ClutterPickStack *pick_stack,
|
||||
g_array_append_val (pick_stack->vertices_stack, rec);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_stack_log_overlap (ClutterPickStack *pick_stack,
|
||||
ClutterActor *actor)
|
||||
{
|
||||
PickRecord rec = { 0 };
|
||||
|
||||
g_assert (!pick_stack->sealed);
|
||||
|
||||
rec.is_overlap = TRUE;
|
||||
rec.actor = actor;
|
||||
rec.clip_index = pick_stack->current_clip_stack_top;
|
||||
|
||||
g_array_append_val (pick_stack->vertices_stack, rec);
|
||||
}
|
||||
|
||||
void
|
||||
clutter_pick_stack_push_clip (ClutterPickStack *pick_stack,
|
||||
const ClutterActorBox *box)
|
||||
@ -428,7 +445,8 @@ clutter_pick_stack_search_actor (ClutterPickStack *pick_stack,
|
||||
PickRecord *rec =
|
||||
&g_array_index (pick_stack->vertices_stack, PickRecord, i);
|
||||
|
||||
if (rec->actor && ray_intersects_record (pick_stack, rec, point, ray))
|
||||
if (!rec->is_overlap && rec->actor &&
|
||||
ray_intersects_record (pick_stack, rec, point, ray))
|
||||
return rec->actor;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user