mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 19:10:43 -05:00
clutter/stage: Remove cached pick mode
The cached pick mode never actually cached anything, since it is always, unconditionally reset when painting. Furthermore, next commits will cull out actors during pick, which makes the pick stack uncacheable. Remove the cached pick mode. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1520>
This commit is contained in:
parent
3073aee7c8
commit
1b29d265a8
@ -124,9 +124,6 @@ struct _ClutterStagePrivate
|
|||||||
GTimer *fps_timer;
|
GTimer *fps_timer;
|
||||||
gint32 timer_n_frames;
|
gint32 timer_n_frames;
|
||||||
|
|
||||||
ClutterPickStack *pick_stack;
|
|
||||||
ClutterPickMode cached_pick_mode;
|
|
||||||
|
|
||||||
ClutterStageState current_state;
|
ClutterStageState current_state;
|
||||||
|
|
||||||
int update_freeze_count;
|
int update_freeze_count;
|
||||||
@ -228,15 +225,6 @@ clutter_stage_get_preferred_height (ClutterActor *self,
|
|||||||
*natural_height_p = geom.height;
|
*natural_height_p = geom.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_clutter_stage_clear_pick_stack (ClutterStage *stage)
|
|
||||||
{
|
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->pick_stack, clutter_pick_stack_unref);
|
|
||||||
priv->cached_pick_mode = CLUTTER_PICK_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_add_redraw_clip (ClutterStage *stage,
|
clutter_stage_add_redraw_clip (ClutterStage *stage,
|
||||||
cairo_rectangle_int_t *clip)
|
cairo_rectangle_int_t *clip)
|
||||||
@ -457,19 +445,12 @@ clutter_stage_do_paint_view (ClutterStage *stage,
|
|||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip)
|
const cairo_region_t *redraw_clip)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
|
||||||
ClutterPaintContext *paint_context;
|
ClutterPaintContext *paint_context;
|
||||||
cairo_rectangle_int_t clip_rect;
|
cairo_rectangle_int_t clip_rect;
|
||||||
g_autoptr (GArray) clip_frusta = NULL;
|
g_autoptr (GArray) clip_frusta = NULL;
|
||||||
graphene_frustum_t clip_frustum;
|
graphene_frustum_t clip_frustum;
|
||||||
int n_rectangles;
|
int n_rectangles;
|
||||||
|
|
||||||
/* Any mode of painting/picking invalidates the pick cache, unless we're
|
|
||||||
* in the middle of building it. So we reset the cached flag but don't
|
|
||||||
* completely clear the pick stack.
|
|
||||||
*/
|
|
||||||
priv->cached_pick_mode = CLUTTER_PICK_NONE;
|
|
||||||
|
|
||||||
n_rectangles = redraw_clip ? cairo_region_num_rectangles (redraw_clip) : 0;
|
n_rectangles = redraw_clip ? cairo_region_num_rectangles (redraw_clip) : 0;
|
||||||
if (redraw_clip && n_rectangles < MAX_FRUSTA)
|
if (redraw_clip && n_rectangles < MAX_FRUSTA)
|
||||||
{
|
{
|
||||||
@ -632,7 +613,6 @@ clutter_stage_hide (ClutterActor *self)
|
|||||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||||
|
|
||||||
g_assert (priv->impl != NULL);
|
g_assert (priv->impl != NULL);
|
||||||
_clutter_stage_clear_pick_stack (CLUTTER_STAGE (self));
|
|
||||||
_clutter_stage_window_hide (priv->impl);
|
_clutter_stage_window_hide (priv->impl);
|
||||||
|
|
||||||
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->hide (self);
|
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->hide (self);
|
||||||
@ -1100,31 +1080,23 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
|
|||||||
ClutterPickMode mode,
|
ClutterPickMode mode,
|
||||||
ClutterStageView *view)
|
ClutterStageView *view)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
g_autoptr (ClutterPickStack) pick_stack = NULL;
|
||||||
|
ClutterPickContext *pick_context;
|
||||||
graphene_point3d_t p;
|
graphene_point3d_t p;
|
||||||
graphene_ray_t ray;
|
graphene_ray_t ray;
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
|
|
||||||
COGL_TRACE_BEGIN_SCOPED (ClutterStagePickView, "Pick (view)");
|
COGL_TRACE_BEGIN_SCOPED (ClutterStagePickView, "Pick (view)");
|
||||||
|
|
||||||
if (!priv->pick_stack || mode != priv->cached_pick_mode)
|
pick_context = clutter_pick_context_new_for_view (view, mode);
|
||||||
{
|
|
||||||
ClutterPickContext *pick_context;
|
|
||||||
|
|
||||||
_clutter_stage_clear_pick_stack (stage);
|
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
|
||||||
|
pick_stack = clutter_pick_context_steal_stack (pick_context);
|
||||||
pick_context = clutter_pick_context_new_for_view (view, mode);
|
clutter_pick_context_destroy (pick_context);
|
||||||
|
|
||||||
clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
|
|
||||||
priv->pick_stack = clutter_pick_context_steal_stack (pick_context);
|
|
||||||
priv->cached_pick_mode = mode;
|
|
||||||
|
|
||||||
clutter_pick_context_destroy (pick_context);
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_ray_for_coordinates (stage, x, y, &p, &ray);
|
setup_ray_for_coordinates (stage, x, y, &p, &ray);
|
||||||
|
|
||||||
actor = clutter_pick_stack_search_actor (priv->pick_stack, &p, &ray);
|
actor = clutter_pick_stack_search_actor (pick_stack, &p, &ray);
|
||||||
return actor ? actor : CLUTTER_ACTOR (stage);
|
return actor ? actor : CLUTTER_ACTOR (stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,8 +1306,6 @@ clutter_stage_finalize (GObject *object)
|
|||||||
|
|
||||||
g_array_free (priv->paint_volume_stack, TRUE);
|
g_array_free (priv->paint_volume_stack, TRUE);
|
||||||
|
|
||||||
_clutter_stage_clear_pick_stack (stage);
|
|
||||||
|
|
||||||
if (priv->fps_timer != NULL)
|
if (priv->fps_timer != NULL)
|
||||||
g_timer_destroy (priv->fps_timer);
|
g_timer_destroy (priv->fps_timer);
|
||||||
|
|
||||||
@ -1653,8 +1623,6 @@ clutter_stage_init (ClutterStage *self)
|
|||||||
|
|
||||||
priv->paint_volume_stack =
|
priv->paint_volume_stack =
|
||||||
g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume));
|
g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume));
|
||||||
|
|
||||||
priv->cached_pick_mode = CLUTTER_PICK_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2727,12 +2695,6 @@ clutter_stage_queue_actor_redraw (ClutterStage *stage,
|
|||||||
CLUTTER_NOTE (CLIPPING, "stage_queue_actor_redraw (actor=%s, clip=%p): ",
|
CLUTTER_NOTE (CLIPPING, "stage_queue_actor_redraw (actor=%s, clip=%p): ",
|
||||||
_clutter_actor_get_debug_name (actor), clip);
|
_clutter_actor_get_debug_name (actor), clip);
|
||||||
|
|
||||||
/* Queuing a redraw or clip change invalidates the pick cache, unless we're
|
|
||||||
* in the middle of building it. So we reset the cached flag but don't
|
|
||||||
* completely clear the pick stack...
|
|
||||||
*/
|
|
||||||
priv->cached_pick_mode = CLUTTER_PICK_NONE;
|
|
||||||
|
|
||||||
if (!priv->pending_finish_queue_redraws)
|
if (!priv->pending_finish_queue_redraws)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
Loading…
Reference in New Issue
Block a user