mirror of
https://github.com/brl/mutter.git
synced 2025-03-28 06:03:47 +00:00
clutter: Use pick context to track the framebuffer
Instead of pushing and popping the Cogl framebuffer stack, use the framebuffer passed around using the pick context. This removes usage of the deprecated framebuffer stack when picking. https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
This commit is contained in:
parent
138907c480
commit
61b1ead1a2
@ -1287,10 +1287,12 @@ clutter_actor_verify_map_state (ClutterActor *self)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
_clutter_actor_transform_local_box_to_stage (ClutterActor *self,
|
||||||
ClutterStage *stage,
|
ClutterStage *stage,
|
||||||
|
ClutterPickContext *pick_context,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
graphene_point_t vertices[4])
|
graphene_point_t vertices[4])
|
||||||
{
|
{
|
||||||
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
|
CoglFramebuffer *fb =
|
||||||
|
clutter_pick_context_get_framebuffer (pick_context);
|
||||||
CoglMatrix stage_transform, inv_stage_transform;
|
CoglMatrix stage_transform, inv_stage_transform;
|
||||||
CoglMatrix modelview, transform_to_stage;
|
CoglMatrix modelview, transform_to_stage;
|
||||||
int v;
|
int v;
|
||||||
@ -1356,12 +1358,14 @@ clutter_actor_pick_box (ClutterActor *self,
|
|||||||
|
|
||||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||||
|
|
||||||
if (_clutter_actor_transform_local_box_to_stage (self, stage, box, vertices))
|
if (_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||||
|
box, vertices))
|
||||||
clutter_stage_log_pick (stage, vertices, self);
|
clutter_stage_log_pick (stage, vertices, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_clutter_actor_push_pick_clip (ClutterActor *self,
|
_clutter_actor_push_pick_clip (ClutterActor *self,
|
||||||
|
ClutterPickContext *pick_context,
|
||||||
const ClutterActorBox *clip)
|
const ClutterActorBox *clip)
|
||||||
{
|
{
|
||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
@ -1369,7 +1373,8 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
|
|||||||
|
|
||||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||||
|
|
||||||
if (!_clutter_actor_transform_local_box_to_stage (self, stage, clip, vertices))
|
if (!_clutter_actor_transform_local_box_to_stage (self, stage, pick_context,
|
||||||
|
clip, vertices))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
clutter_stage_push_pick_clip (stage, vertices);
|
clutter_stage_push_pick_clip (stage, vertices);
|
||||||
@ -4183,6 +4188,7 @@ clutter_actor_pick (ClutterActor *actor,
|
|||||||
ClutterPickContext *pick_context)
|
ClutterPickContext *pick_context)
|
||||||
{
|
{
|
||||||
ClutterActorPrivate *priv;
|
ClutterActorPrivate *priv;
|
||||||
|
CoglFramebuffer *framebuffer;
|
||||||
ClutterActorBox clip;
|
ClutterActorBox clip;
|
||||||
gboolean clip_set = FALSE;
|
gboolean clip_set = FALSE;
|
||||||
|
|
||||||
@ -4202,15 +4208,16 @@ clutter_actor_pick (ClutterActor *actor,
|
|||||||
/* mark that we are in the paint process */
|
/* mark that we are in the paint process */
|
||||||
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||||
|
|
||||||
cogl_push_matrix ();
|
framebuffer = clutter_pick_context_get_framebuffer (pick_context);
|
||||||
|
cogl_framebuffer_push_matrix (framebuffer);
|
||||||
|
|
||||||
if (priv->enable_model_view_transform)
|
if (priv->enable_model_view_transform)
|
||||||
{
|
{
|
||||||
CoglMatrix matrix;
|
CoglMatrix matrix;
|
||||||
|
|
||||||
cogl_get_modelview_matrix (&matrix);
|
cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix);
|
||||||
_clutter_actor_apply_modelview_transform (actor, &matrix);
|
_clutter_actor_apply_modelview_transform (actor, &matrix);
|
||||||
cogl_set_modelview_matrix (&matrix);
|
cogl_framebuffer_set_modelview_matrix (framebuffer, &matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->has_clip)
|
if (priv->has_clip)
|
||||||
@ -4231,7 +4238,7 @@ clutter_actor_pick (ClutterActor *actor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (clip_set)
|
if (clip_set)
|
||||||
clip_set = _clutter_actor_push_pick_clip (actor, &clip);
|
clip_set = _clutter_actor_push_pick_clip (actor, pick_context, &clip);
|
||||||
|
|
||||||
priv->next_effect_to_paint = NULL;
|
priv->next_effect_to_paint = NULL;
|
||||||
if (priv->effects)
|
if (priv->effects)
|
||||||
@ -4245,7 +4252,7 @@ clutter_actor_pick (ClutterActor *actor,
|
|||||||
if (clip_set)
|
if (clip_set)
|
||||||
_clutter_actor_pop_pick_clip (actor);
|
_clutter_actor_pop_pick_clip (actor);
|
||||||
|
|
||||||
cogl_pop_matrix ();
|
cogl_framebuffer_pop_matrix (framebuffer);
|
||||||
|
|
||||||
/* paint sequence complete */
|
/* paint sequence complete */
|
||||||
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
CLUTTER_UNSET_PRIVATE_FLAGS (actor, CLUTTER_IN_PICK);
|
||||||
|
@ -1647,7 +1647,6 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
|||||||
{
|
{
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
ClutterMainContext *context = _clutter_context_get_default ();
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (view);
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_assert (context->pick_mode == CLUTTER_PICK_NONE);
|
g_assert (context->pick_mode == CLUTTER_PICK_NONE);
|
||||||
@ -1659,7 +1658,6 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
|||||||
_clutter_stage_clear_pick_stack (stage);
|
_clutter_stage_clear_pick_stack (stage);
|
||||||
|
|
||||||
pick_context = clutter_pick_context_new_for_view (view);
|
pick_context = clutter_pick_context_new_for_view (view);
|
||||||
cogl_push_framebuffer (fb);
|
|
||||||
|
|
||||||
context->pick_mode = mode;
|
context->pick_mode = mode;
|
||||||
setup_view_for_pick_or_paint (stage, view, NULL);
|
setup_view_for_pick_or_paint (stage, view, NULL);
|
||||||
@ -1667,7 +1665,6 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
|||||||
context->pick_mode = CLUTTER_PICK_NONE;
|
context->pick_mode = CLUTTER_PICK_NONE;
|
||||||
priv->cached_pick_mode = mode;
|
priv->cached_pick_mode = mode;
|
||||||
|
|
||||||
cogl_pop_framebuffer ();
|
|
||||||
clutter_pick_context_destroy (pick_context);
|
clutter_pick_context_destroy (pick_context);
|
||||||
|
|
||||||
add_pick_stack_weak_refs (stage);
|
add_pick_stack_weak_refs (stage);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user