Start to reduce dependence on glib

Since we've had several developers from admirable projects say they
would like to use Cogl but would really prefer not to pull in
gobject,gmodule and glib as extra dependencies we are investigating if
we can get to the point where glib is only an optional dependency.
Actually we feel like we only make minimal use of glib anyway, so it may
well be quite straightforward to achieve this.

This adds a --disable-glib configure option that can be used to disable
features that depend on glib.

Actually --disable-glib doesn't strictly disable glib at this point
because it's more helpful if cogl continues to build as we make
incremental progress towards this.

The first use of glib that this patch tackles is the use of
g_return_val_if_fail and g_return_if_fail which have been replaced with
equivalent _COGL_RETURN_VAL_IF_FAIL and _COGL_RETURN_IF_FAIL macros.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg
2011-10-13 22:34:30 +01:00
parent fd67ddd56e
commit b72f255c0a
49 changed files with 381 additions and 300 deletions

View File

@ -297,7 +297,7 @@ _cogl_pipeline_promote_weak_ancestors (CoglPipeline *strong)
{
CoglNode *n;
g_return_if_fail (!strong->is_weak);
_COGL_RETURN_IF_FAIL (!strong->is_weak);
/* If the parent of strong is weak, then we want to promote it by
taking a reference on strong's grandparent. We don't need to take
@ -319,7 +319,7 @@ _cogl_pipeline_revert_weak_ancestors (CoglPipeline *strong)
{
CoglNode *n;
g_return_if_fail (!strong->is_weak);
_COGL_RETURN_IF_FAIL (!strong->is_weak);
/* This reverts the effect of calling
_cogl_pipeline_promote_weak_ancestors */
@ -478,7 +478,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
gboolean
_cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline)
{
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
return pipeline->real_blend_enable;
}
@ -583,7 +583,7 @@ _cogl_pipeline_foreach_layer_internal (CoglPipeline *pipeline,
for (i = 0, cont = TRUE; i < n_layers && cont == TRUE; i++)
{
g_return_if_fail (authority->layers_cache_dirty == FALSE);
_COGL_RETURN_IF_FAIL (authority->layers_cache_dirty == FALSE);
cont = callback (authority->layers_cache[i], user_data);
}
}
@ -945,7 +945,7 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
{
CoglPipeline *authority;
g_return_if_fail (change & COGL_PIPELINE_STATE_ALL_SPARSE);
_COGL_RETURN_IF_FAIL (change & COGL_PIPELINE_STATE_ALL_SPARSE);
if (!(change & COGL_PIPELINE_STATE_MULTI_PROPERTY))
return;
@ -1285,7 +1285,7 @@ _cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
CoglPipelineLayer *layer,
gboolean inc_n_layers)
{
g_return_if_fail (layer->owner == NULL);
_COGL_RETURN_IF_FAIL (layer->owner == NULL);
layer->owner = pipeline;
cogl_object_ref (layer);
@ -1319,7 +1319,7 @@ _cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline,
CoglPipelineLayer *layer,
gboolean dec_n_layers)
{
g_return_if_fail (layer->owner == pipeline);
_COGL_RETURN_IF_FAIL (layer->owner == pipeline);
/* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified.
@ -1692,7 +1692,7 @@ _cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority,
CoglPipelineLayerInfo layer_info;
CoglPipeline *old_layers_authority;
g_return_if_fail (link != NULL);
_COGL_RETURN_IF_FAIL (link != NULL);
/* If the layer's parent doesn't have an owner then we can simply
* take ownership ourselves and drop our reference on the empty
@ -2289,7 +2289,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
{
CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG);
@ -2299,7 +2299,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
unsigned long
_cogl_pipeline_get_age (CoglPipeline *pipeline)
{
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
return pipeline->age;
}
@ -2311,7 +2311,7 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline, int layer_index)
CoglPipelineLayerInfo layer_info;
int i;
g_return_if_fail (cogl_is_pipeline (pipeline));
_COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);
@ -2374,7 +2374,7 @@ prepend_layer_to_list_cb (CoglPipelineLayer *layer,
const GList *
_cogl_pipeline_get_layers (CoglPipeline *pipeline)
{
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL);
if (!pipeline->deprecated_get_layers_list_dirty)
g_list_free (pipeline->deprecated_get_layers_list);
@ -2397,7 +2397,7 @@ cogl_pipeline_get_n_layers (CoglPipeline *pipeline)
{
CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);