backend: Remove ClutterBackend::redraw

The ::redraw virtual function was a throwback from olden times, and has
been thoroughly replaced by the equivalent vfunc on the StageWindow
interface. We can safely remove it, now, and simplify the flow of the
redraw code inside ClutterStage.
This commit is contained in:
Emmanuele Bassi 2012-01-12 13:31:21 +00:00
parent 0c365f9f4c
commit 646cf236a5
3 changed files with 54 additions and 81 deletions

View File

@ -70,8 +70,6 @@ struct _ClutterBackendClass
void (* add_options) (ClutterBackend *backend,
GOptionGroup *group);
ClutterFeatureFlags (* get_features) (ClutterBackend *backend);
void (* redraw) (ClutterBackend *backend,
ClutterStage *stage);
CoglRenderer * (* get_renderer) (ClutterBackend *backend,
GError **error);
CoglDisplay * (* get_display) (ClutterBackend *backend,
@ -100,49 +98,42 @@ struct _ClutterBackendClass
void (* settings_changed) (ClutterBackend *backend);
};
void _clutter_backend_redraw (ClutterBackend *backend,
ClutterStage *stage);
ClutterStageWindow *_clutter_backend_create_stage (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
void _clutter_backend_ensure_context (ClutterBackend *backend,
ClutterStage *stage);
void _clutter_backend_ensure_context_internal
(ClutterBackend *backend,
ClutterStage *stage);
gboolean _clutter_backend_create_context (ClutterBackend *backend,
GError **error);
ClutterStageWindow * _clutter_backend_create_stage (ClutterBackend *backend,
ClutterStage *wrapper,
GError **error);
void _clutter_backend_ensure_context (ClutterBackend *backend,
ClutterStage *stage);
void _clutter_backend_ensure_context_internal (ClutterBackend *backend,
ClutterStage *stage);
gboolean _clutter_backend_create_context (ClutterBackend *backend,
GError **error);
void _clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group);
gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_post_parse (ClutterBackend *backend,
GError **error);
void _clutter_backend_init_events (ClutterBackend *backend);
void _clutter_backend_add_options (ClutterBackend *backend,
GOptionGroup *group);
gboolean _clutter_backend_pre_parse (ClutterBackend *backend,
GError **error);
gboolean _clutter_backend_post_parse (ClutterBackend *backend,
GError **error);
void _clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest);
void _clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event);
void _clutter_backend_init_events (ClutterBackend *backend);
void _clutter_backend_copy_event_data (ClutterBackend *backend,
const ClutterEvent *src,
ClutterEvent *dest);
void _clutter_backend_free_event_data (ClutterBackend *backend,
ClutterEvent *event);
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
void _clutter_backend_add_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
void _clutter_backend_remove_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
PangoFontDescription *font_desc);
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
gboolean _clutter_backend_translate_event (ClutterBackend *backend,
gpointer native,
ClutterEvent *event);
void _clutter_backend_add_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
void _clutter_backend_remove_event_translator (ClutterBackend *backend,
ClutterEventTranslator *translator);
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend,
PangoFontDescription *font_desc);
gint32 _clutter_backend_get_units_serial (ClutterBackend *backend);
G_END_DECLS

View File

@ -441,22 +441,6 @@ clutter_backend_real_create_stage (ClutterBackend *backend,
NULL);
}
static void
clutter_backend_real_redraw (ClutterBackend *backend,
ClutterStage *stage)
{
ClutterStageWindow *impl;
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return;
impl = _clutter_stage_get_window (stage);
if (impl == NULL)
return;
_clutter_stage_window_redraw (impl);
}
static void
clutter_backend_real_init_events (ClutterBackend *backend)
{
@ -650,7 +634,6 @@ clutter_backend_class_init (ClutterBackendClass *klass)
klass->ensure_context = clutter_backend_real_ensure_context;
klass->get_features = clutter_backend_real_get_features;
klass->create_stage = clutter_backend_real_create_stage;
klass->redraw = clutter_backend_real_redraw;
}
static void
@ -732,28 +715,6 @@ _clutter_backend_create_stage (ClutterBackend *backend,
return stage_window;
}
void
_clutter_backend_redraw (ClutterBackend *backend,
ClutterStage *stage)
{
CLUTTER_STATIC_COUNTER (redraw_counter,
"_clutter_backend_redraw counter",
"Increments for each _clutter_backend_redraw call",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (redraw_timer,
"Master Clock", /* parent */
"Redrawing",
"The time spent redrawing everything",
0 /* no application private data */);
CLUTTER_COUNTER_INC (_clutter_uprof_context, redraw_counter);
CLUTTER_TIMER_START (_clutter_uprof_context, redraw_timer);
CLUTTER_BACKEND_GET_CLASS (backend)->redraw (backend, stage);
CLUTTER_TIMER_STOP (_clutter_uprof_context, redraw_timer);
}
gboolean
_clutter_backend_create_context (ClutterBackend *backend,
GError **error)

View File

@ -1033,6 +1033,22 @@ clutter_stage_do_redraw (ClutterStage *stage)
ClutterActor *actor = CLUTTER_ACTOR (stage);
ClutterStagePrivate *priv = stage->priv;
CLUTTER_STATIC_COUNTER (redraw_counter,
"clutter_stage_do_redraw counter",
"Increments for each Stage redraw",
0 /* no application private data */);
CLUTTER_STATIC_TIMER (redraw_timer,
"Master Clock", /* parent */
"Redrawing",
"The time spent redrawing everything",
0 /* no application private data */);
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return;
if (priv->impl == NULL)
return;
CLUTTER_NOTE (PAINT, "Redraw started for stage '%s'[%p]",
_clutter_actor_get_debug_name (actor),
stage);
@ -1050,7 +1066,12 @@ clutter_stage_do_redraw (ClutterStage *stage)
_clutter_stage_maybe_setup_viewport (stage);
_clutter_backend_redraw (backend, stage);
CLUTTER_COUNTER_INC (_clutter_uprof_context, redraw_counter);
CLUTTER_TIMER_START (_clutter_uprof_context, redraw_timer);
_clutter_stage_window_redraw (priv->impl);
CLUTTER_TIMER_STOP (_clutter_uprof_context, redraw_timer);
if (_clutter_context_get_show_fps ())
{