[Cogl] [PATCH 1/2] cogl-pango: Updates to no longer require a default context

Neil Roberts neil at linux.intel.com
Wed May 16 04:21:45 PDT 2012


Just two minor suggestions:

Robert Bragg <robert at sixbynine.org> writes:

> +PangoFontMap *
> +cogl_pango_font_map_get_default (CoglContext *context)
> +{
> +  if (G_UNLIKELY (!default_font_map))
> +    default_font_map = cogl_pango_font_map_new (context);
>  
> -  return renderer;
> +  return default_font_map;
> +}

I wonder if it might be better to attach the default font map as user
data on the context instead of storing it in a global variable. I guess
it's kind of academic as it's pretty unlikely that an application would
ever use more than one CoglContext but it seems a bit odd that you can
pass in a context yet there is only one single global font map and you
would end up getting one that is attached to a different CoglContext if
you tried to use multiple contexts.

> +PangoRenderer *
> +_cogl_pango_renderer_get_default (CoglContext *context)
> +{
> +  if (G_UNLIKELY (!default_renderer))
> +    default_renderer = _cogl_pango_renderer_new (context);
> +
> +  return default_renderer;
> +}

Same here. This one is probably more important because it's used
internally so it would mean you really can't use cogl-pango with more
than one Cogl context.

Otherwise looks good to me.

Reviewed-by: Neil Roberts <neil at linux.intel.com>

- Neil


More information about the Cogl mailing list