1
0
Fork 0

clutter/pick-context: Get CoglContext from actor context

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
This commit is contained in:
Bilal Elmoussaoui 2024-08-21 00:35:58 +02:00
parent 617a3aa58b
commit b3da64c20e
3 changed files with 10 additions and 4 deletions

View file

@ -22,6 +22,7 @@
ClutterPickContext *
clutter_pick_context_new_for_view (ClutterStageView *view,
CoglContext *cogl_context,
ClutterPickMode mode,
const graphene_point3d_t *point,
const graphene_ray_t *ray);

View file

@ -37,12 +37,12 @@ G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context,
ClutterPickContext *
clutter_pick_context_new_for_view (ClutterStageView *view,
CoglContext *cogl_context,
ClutterPickMode mode,
const graphene_point3d_t *point,
const graphene_ray_t *ray)
{
ClutterPickContext *pick_context;
CoglContext *context;
pick_context = g_new0 (ClutterPickContext, 1);
g_ref_count_init (&pick_context->ref_count);
@ -50,8 +50,7 @@ clutter_pick_context_new_for_view (ClutterStageView *view,
graphene_ray_init_from_ray (&pick_context->ray, ray);
graphene_point3d_init_from_point (&pick_context->point, point);
context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
pick_context->pick_stack = clutter_pick_stack_new (context);
pick_context->pick_stack = clutter_pick_stack_new (cogl_context);
return pick_context;
}

View file

@ -1051,7 +1051,10 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
MtkRegion **clear_area)
{
g_autoptr (ClutterPickStack) pick_stack = NULL;
ClutterContext *context;
ClutterBackend *backend;
ClutterPickContext *pick_context;
CoglContext *cogl_context;
graphene_point3d_t p;
graphene_ray_t ray;
ClutterActor *actor;
@ -1060,7 +1063,10 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
setup_ray_for_coordinates (stage, x, y, &p, &ray);
pick_context = clutter_pick_context_new_for_view (view, mode, &p, &ray);
context = clutter_actor_get_context (CLUTTER_ACTOR (stage));
backend = clutter_context_get_backend (context);
cogl_context = clutter_backend_get_cogl_context (backend);
pick_context = clutter_pick_context_new_for_view (view, cogl_context, mode, &p, &ray);
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
pick_stack = clutter_pick_context_steal_stack (pick_context);