From: Emmanuele Bassi Date: Fri, 18 Feb 2011 12:07:07 +0000 (+0000) Subject: Continue hiding the ClutterMainContext X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89a0d514b4762ea2e0e604b02381c8951cb26d4f;p=profile%2Fivi%2Fclutter.git Continue hiding the ClutterMainContext We should strive to make the main context as transparent as possible, and hide accessing its data through private functions. --- diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 7606705..e2974bf 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -448,7 +448,6 @@ struct _ClutterActorPrivate gdouble scale_x; gdouble scale_y; - AnchorCoord scale_center; PangoContext *pango_context; @@ -1662,14 +1661,10 @@ clutter_actor_real_pick (ClutterActor *self, gboolean clutter_actor_should_pick_paint (ClutterActor *self) { - ClutterMainContext *context; - g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE); - context = _clutter_context_get_default (); - if (CLUTTER_ACTOR_IS_MAPPED (self) && - (G_UNLIKELY (context->pick_mode == CLUTTER_PICK_ALL) || + (_clutter_context_get_pick_mode () == CLUTTER_PICK_ALL || CLUTTER_ACTOR_IS_REACTIVE (self))) return TRUE; @@ -2559,7 +2554,7 @@ void clutter_actor_paint (ClutterActor *self) { ClutterActorPrivate *priv; - ClutterMainContext *context; + ClutterPickMode pick_mode; gboolean clip_set = FALSE; CLUTTER_STATIC_COUNTER (actor_paint_counter, "Actor real-paint counter", @@ -2578,11 +2573,11 @@ clutter_actor_paint (ClutterActor *self) priv = self->priv; - context = _clutter_context_get_default (); + pick_mode = _clutter_context_get_pick_mode (); /* It's an important optimization that we consider painting of * actors with 0 opacity to be a NOP... */ - if (context->pick_mode == CLUTTER_PICK_NONE && + if (pick_mode == CLUTTER_PICK_NONE && /* ignore top-levels, since they might be transparent */ !CLUTTER_ACTOR_IS_TOPLEVEL (self) && /* Use the override opacity if its been set */ @@ -2634,7 +2629,7 @@ clutter_actor_paint (ClutterActor *self) clip_set = TRUE; } - if (context->pick_mode == CLUTTER_PICK_NONE) + if (pick_mode == CLUTTER_PICK_NONE) { gboolean effect_painted = FALSE; gboolean need_paint_box; @@ -10112,17 +10107,15 @@ PangoContext * clutter_actor_get_pango_context (ClutterActor *self) { ClutterActorPrivate *priv; - ClutterMainContext *ctx; g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL); priv = self->priv; - if (priv->pango_context) + if (priv->pango_context != NULL) return priv->pango_context; - ctx = CLUTTER_CONTEXT (); - priv->pango_context = _clutter_context_get_pango_context (ctx); + priv->pango_context = _clutter_context_get_pango_context (); g_object_ref (priv->pango_context); return priv->pango_context; @@ -10147,15 +10140,9 @@ clutter_actor_get_pango_context (ClutterActor *self) PangoContext * clutter_actor_create_pango_context (ClutterActor *self) { - ClutterMainContext *ctx; - PangoContext *retval; - g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL); - ctx = CLUTTER_CONTEXT (); - retval = _clutter_context_create_pango_context (ctx); - - return retval; + return _clutter_context_create_pango_context (); } /** diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 9d0e440..32ed33c 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -814,13 +814,15 @@ update_pango_context (ClutterBackend *backend, } PangoContext * -_clutter_context_get_pango_context (ClutterMainContext *self) +_clutter_context_get_pango_context (void) { + ClutterMainContext *self = _clutter_context_get_default (); + if (G_UNLIKELY (self->pango_context == NULL)) { PangoContext *context; - context = _clutter_context_create_pango_context (self); + context = _clutter_context_create_pango_context (); self->pango_context = context; g_signal_connect (self->backend, "resolution-changed", @@ -837,8 +839,9 @@ _clutter_context_get_pango_context (ClutterMainContext *self) } PangoContext * -_clutter_context_create_pango_context (ClutterMainContext *self) +_clutter_context_create_pango_context (void) { + ClutterMainContext *self = _clutter_context_get_default (); CoglPangoFontMap *font_map; PangoContext *context; @@ -3313,3 +3316,11 @@ _clutter_clear_events_queue_for_stage (ClutterStage *stage) } } } + +ClutterPickMode +_clutter_context_get_pick_mode (void) +{ + ClutterMainContext *context = _clutter_context_get_default (); + + return context->pick_mode; +} diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index b06018d..9a7c3be 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -175,8 +175,9 @@ void _clutter_threads_dispatch_free (gpointer data); #define CLUTTER_CONTEXT() (_clutter_context_get_default ()) ClutterMainContext * _clutter_context_get_default (void); gboolean _clutter_context_is_initialized (void); -PangoContext * _clutter_context_create_pango_context (ClutterMainContext *self); -PangoContext * _clutter_context_get_pango_context (ClutterMainContext *self); +PangoContext * _clutter_context_create_pango_context (void); +PangoContext * _clutter_context_get_pango_context (void); +ClutterPickMode _clutter_context_get_pick_mode (void); #define CLUTTER_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS) #define CLUTTER_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)