[mutter/gbsneto/pick-culling: 2/5] clutter/stage: Remove cached pick mode
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/pick-culling: 2/5] clutter/stage: Remove cached pick mode
- Date: Fri, 23 Oct 2020 00:18:57 +0000 (UTC)
commit e0fa774b21b3416ae5a8f98845970b1926387177
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Oct 22 19:34:51 2020 -0300
clutter/stage: Remove cached pick mode
clutter/clutter/clutter-stage.c | 52 ++++++-----------------------------------
1 file changed, 7 insertions(+), 45 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 7aed09d53c..a1c8f9dcb1 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -125,9 +125,6 @@ struct _ClutterStagePrivate
GTimer *fps_timer;
gint32 timer_n_frames;
- ClutterPickStack *pick_stack;
- ClutterPickMode cached_pick_mode;
-
#ifdef CLUTTER_ENABLE_DEBUG
gulong redraw_count;
#endif /* CLUTTER_ENABLE_DEBUG */
@@ -234,15 +231,6 @@ clutter_stage_get_preferred_height (ClutterActor *self,
*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
clutter_stage_add_redraw_clip (ClutterStage *stage,
cairo_rectangle_int_t *clip)
@@ -463,19 +451,12 @@ clutter_stage_do_paint_view (ClutterStage *stage,
ClutterStageView *view,
const cairo_region_t *redraw_clip)
{
- ClutterStagePrivate *priv = stage->priv;
ClutterPaintContext *paint_context;
cairo_rectangle_int_t clip_rect;
g_autoptr (GArray) clip_frusta = NULL;
graphene_frustum_t clip_frustum;
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;
if (redraw_clip && n_rectangles < MAX_FRUSTA)
{
@@ -638,7 +619,6 @@ clutter_stage_hide (ClutterActor *self)
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
g_assert (priv->impl != NULL);
- _clutter_stage_clear_pick_stack (CLUTTER_STAGE (self));
_clutter_stage_window_hide (priv->impl);
CLUTTER_ACTOR_CLASS (clutter_stage_parent_class)->hide (self);
@@ -1169,31 +1149,23 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
ClutterPickMode mode,
ClutterStageView *view)
{
- ClutterStagePrivate *priv = stage->priv;
+ g_autoptr (ClutterPickStack) pick_stack = NULL;
+ ClutterPickContext *pick_context;
graphene_point3d_t p;
graphene_ray_t ray;
ClutterActor *actor;
COGL_TRACE_BEGIN_SCOPED (ClutterStagePickView, "Pick (view)");
- if (!priv->pick_stack || mode != priv->cached_pick_mode)
- {
- ClutterPickContext *pick_context;
-
- _clutter_stage_clear_pick_stack (stage);
-
- pick_context = clutter_pick_context_new_for_view (view, mode);
-
- clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
- priv->pick_stack = clutter_pick_context_steal_stack (pick_context);
- priv->cached_pick_mode = mode;
+ pick_context = clutter_pick_context_new_for_view (view, mode);
- clutter_pick_context_destroy (pick_context);
- }
+ clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context);
+ pick_stack = clutter_pick_context_steal_stack (pick_context);
+ clutter_pick_context_destroy (pick_context);
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);
}
@@ -1405,8 +1377,6 @@ clutter_stage_finalize (GObject *object)
g_array_free (priv->paint_volume_stack, TRUE);
- _clutter_stage_clear_pick_stack (stage);
-
if (priv->fps_timer != NULL)
g_timer_destroy (priv->fps_timer);
@@ -1720,8 +1690,6 @@ clutter_stage_init (ClutterStage *self)
priv->paint_volume_stack =
g_array_new (FALSE, FALSE, sizeof (ClutterPaintVolume));
-
- priv->cached_pick_mode = CLUTTER_PICK_NONE;
}
static void
@@ -2794,12 +2762,6 @@ _clutter_stage_queue_actor_redraw (ClutterStage *stage,
CLUTTER_NOTE (CLIPPING, "stage_queue_actor_redraw (actor=%s, clip=%p): ",
_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)
{
GList *l;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]