mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
2008-06-13 Emmanuele Bassi <ebassi@openedhand.com>
Bug #960 - PangoContext creation code should not be duplicated * clutter/clutter-private.h: * clutter/clutter-main.c: (_clutter_context_create_pango_context): Abstract the creation of the PangoContext inside its own function, to avoid code and bugs duplication. (Tommi Komulainen) * clutter/clutter-entry.c (clutter_entry_init): Use the newly added PangoContext creation function. * clutter/clutter-label.c (clutter_label_init): Ditto as above.
This commit is contained in:
parent
d1006ca506
commit
be0711b88b
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2008-06-13 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
Bug #960 - PangoContext creation code should not be duplicated
|
||||
|
||||
* clutter/clutter-private.h:
|
||||
* clutter/clutter-main.c:
|
||||
(_clutter_context_create_pango_context): Abstract the creation
|
||||
of the PangoContext inside its own function, to avoid code and
|
||||
bugs duplication. (Tommi Komulainen)
|
||||
|
||||
* clutter/clutter-entry.c (clutter_entry_init): Use the newly
|
||||
added PangoContext creation function.
|
||||
|
||||
* clutter/clutter-label.c (clutter_label_init): Ditto as above.
|
||||
|
||||
2008-06-12 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
Bug #964 - "unrealized" signal of ClutterActor wrongly named
|
||||
|
@ -866,23 +866,10 @@ clutter_entry_init (ClutterEntry *self)
|
||||
|
||||
self->priv = priv = CLUTTER_ENTRY_GET_PRIVATE (self);
|
||||
|
||||
resolution = clutter_backend_get_resolution (clutter_get_default_backend ());
|
||||
if (resolution < 0)
|
||||
resolution = 96.0; /* fall back */
|
||||
|
||||
if (G_UNLIKELY (_context == NULL))
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
PangoClutterFontMap *font_map = CLUTTER_CONTEXT ()->font_map;
|
||||
cairo_font_options_t *font_options;
|
||||
_context = _clutter_context_create_pango_context (CLUTTER_CONTEXT ());
|
||||
|
||||
_context = pango_clutter_font_map_create_context (font_map);
|
||||
|
||||
pango_cairo_context_set_resolution (_context, resolution);
|
||||
|
||||
font_options = clutter_backend_get_font_options (backend);
|
||||
pango_cairo_context_set_font_options (_context, font_options);
|
||||
}
|
||||
resolution = pango_cairo_context_get_resolution (_context);
|
||||
|
||||
priv->alignment = PANGO_ALIGN_LEFT;
|
||||
priv->wrap = FALSE;
|
||||
|
@ -561,22 +561,7 @@ clutter_label_init (ClutterLabel *self)
|
||||
self->priv = priv = CLUTTER_LABEL_GET_PRIVATE (self);
|
||||
|
||||
if (G_UNLIKELY (_context == NULL))
|
||||
{
|
||||
ClutterBackend *backend = clutter_get_default_backend ();
|
||||
PangoClutterFontMap *font_map = CLUTTER_CONTEXT ()->font_map;
|
||||
gdouble resolution;
|
||||
cairo_font_options_t *font_options;
|
||||
|
||||
_context = pango_clutter_font_map_create_context (font_map);
|
||||
|
||||
resolution = clutter_backend_get_resolution (backend);
|
||||
if (resolution < 0)
|
||||
resolution = 96.0;
|
||||
pango_cairo_context_set_resolution (_context, resolution);
|
||||
|
||||
font_options = clutter_backend_get_font_options (backend);
|
||||
pango_cairo_context_set_font_options (_context, font_options);
|
||||
}
|
||||
_context = _clutter_context_create_pango_context (CLUTTER_CONTEXT ());
|
||||
|
||||
priv->alignment = PANGO_ALIGN_LEFT;
|
||||
priv->wrap = FALSE;
|
||||
|
@ -414,6 +414,27 @@ clutter_context_free (ClutterMainContext *context)
|
||||
g_free (context);
|
||||
}
|
||||
|
||||
PangoContext *
|
||||
_clutter_context_create_pango_context (ClutterMainContext *self)
|
||||
{
|
||||
PangoContext *context;
|
||||
gdouble resolution;
|
||||
cairo_font_options_t *font_options;
|
||||
|
||||
resolution = clutter_backend_get_resolution (self->backend);
|
||||
if (resolution < 0)
|
||||
resolution = 96.0; /* fall back */
|
||||
|
||||
context = pango_clutter_font_map_create_context (self->font_map);
|
||||
|
||||
pango_cairo_context_set_resolution (context, resolution);
|
||||
|
||||
font_options = clutter_backend_get_font_options (self->backend);
|
||||
pango_cairo_context_set_font_options (context, font_options);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_main_quit:
|
||||
*
|
||||
|
@ -114,6 +114,7 @@ or enter/leave events */
|
||||
|
||||
#define CLUTTER_CONTEXT() (clutter_context_get_default ())
|
||||
ClutterMainContext *clutter_context_get_default (void);
|
||||
PangoContext *_clutter_context_create_pango_context (ClutterMainContext *self);
|
||||
|
||||
#define CLUTTER_PRIVATE_FLAGS(a) (((ClutterActor *) (a))->private_flags)
|
||||
#define CLUTTER_SET_PRIVATE_FLAGS(a,f) (CLUTTER_PRIVATE_FLAGS (a) |= (f))
|
||||
|
Loading…
Reference in New Issue
Block a user