[backend] Abstract the GL context creation

This is the another step into abstracting the backend operations
that are currently spread all across the board back into the
backend implementations where they belong.

The GL context creation, for instance, is demanded to the stage
realization which makes it a critical path for every operation
that is GL-context bound. This usually does not make any difference
since we realize the default stage, but at some point we might
start looking into avoiding the default stage realization in order
to make the Clutter startup faster.

It also makes the code maintainable because every part is self
contained and can be reworked with the minimum amount of pain.
This commit is contained in:
Emmanuele Bassi
2009-05-13 22:21:48 +01:00
parent 1d7a79f343
commit aa1246e891
5 changed files with 110 additions and 42 deletions

View File

@ -300,6 +300,22 @@ _clutter_backend_redraw (ClutterBackend *backend,
klass->redraw (backend, stage);
}
gboolean
_clutter_backend_create_context (ClutterBackend *backend,
gboolean is_offscreen,
GError **error)
{
ClutterBackendClass *klass;
g_return_val_if_fail (CLUTTER_IS_BACKEND (backend), FALSE);
klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (klass->create_context)
return klass->create_context (backend, is_offscreen, error);
return TRUE;
}
void
_clutter_backend_ensure_context (ClutterBackend *backend,
ClutterStage *stage)