2008-04-17 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-fixed.c:
	(clutter_value_transform_fixed_int),
	(clutter_value_transform_fixed_double),
	(clutter_value_transform_fixed_float),
	(clutter_fixed_get_type): Add GValue transformation functions
	for ClutterFixed; copying a CLUTTER_TYPE_FIXED GValue into
	a G_TYPE_FLOAT/G_TYPE_DOUBLE one will automatically transform
	the fixed point representation into a floating point one. Also
	add the G_TYPE_INT transformation function to do a plain
	fixed->int copy.

	* clutter/clutter-units.c:
	(clutter_value_transform_unit_int),
	(clutter_unit_get_type): Add a unit->int transformation function.
This commit is contained in:
Emmanuele Bassi 2008-04-17 14:08:26 +00:00
parent fa3b3e7f55
commit fd70c7df49
3 changed files with 55 additions and 0 deletions

View File

@ -1,3 +1,20 @@
2008-04-17 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-fixed.c:
(clutter_value_transform_fixed_int),
(clutter_value_transform_fixed_double),
(clutter_value_transform_fixed_float),
(clutter_fixed_get_type): Add GValue transformation functions
for ClutterFixed; copying a CLUTTER_TYPE_FIXED GValue into
a G_TYPE_FLOAT/G_TYPE_DOUBLE one will automatically transform
the fixed point representation into a floating point one. Also
add the G_TYPE_INT transformation function to do a plain
fixed->int copy.
* clutter/clutter-units.c:
(clutter_value_transform_unit_int),
(clutter_unit_get_type): Add a unit->int transformation function.
2008-04-17 Emmanuele Bassi <ebassi@openedhand.com> 2008-04-17 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-fixed.c (clutter_value_get_fixed): Fix typo * clutter/clutter-fixed.c (clutter_value_get_fixed): Fix typo

View File

@ -1031,6 +1031,27 @@ clutter_value_lcopy_fixed (const GValue *value,
return NULL; return NULL;
} }
static void
clutter_value_transform_fixed_int (const GValue *src,
GValue *dest)
{
dest->data[0].v_int = src->data[0].v_int;
}
static void
clutter_value_transform_fixed_double (const GValue *src,
GValue *dest)
{
dest->data[0].v_double = CLUTTER_FIXED_TO_DOUBLE (src->data[0].v_int);
}
static void
clutter_value_transform_fixed_float (const GValue *src,
GValue *dest)
{
dest->data[0].v_float = CLUTTER_FIXED_TO_FLOAT (src->data[0].v_int);
}
static const GTypeValueTable _clutter_fixed_value_table = { static const GTypeValueTable _clutter_fixed_value_table = {
clutter_value_init_fixed, clutter_value_init_fixed,
NULL, NULL,
@ -1054,6 +1075,13 @@ clutter_fixed_get_type (void)
g_type_register_fundamental (g_type_fundamental_next (), g_type_register_fundamental (g_type_fundamental_next (),
I_("ClutterFixed"), I_("ClutterFixed"),
&_info, &_finfo, 0); &_info, &_finfo, 0);
g_value_register_transform_func (_clutter_fixed_type, G_TYPE_INT,
clutter_value_transform_fixed_int);
g_value_register_transform_func (_clutter_fixed_type, G_TYPE_FLOAT,
clutter_value_transform_fixed_float);
g_value_register_transform_func (_clutter_fixed_type, G_TYPE_DOUBLE,
clutter_value_transform_fixed_double);
} }
return _clutter_fixed_type; return _clutter_fixed_type;

View File

@ -110,6 +110,13 @@ clutter_value_lcopy_unit (const GValue *value,
return NULL; return NULL;
} }
static void
clutter_value_transform_unit_int (const GValue *src,
GValue *dest)
{
dest->data[0].v_int = src->data[0].v_int;
}
static const GTypeValueTable _clutter_unit_value_table = { static const GTypeValueTable _clutter_unit_value_table = {
clutter_value_init_unit, clutter_value_init_unit,
NULL, NULL,
@ -133,6 +140,9 @@ clutter_unit_get_type (void)
g_type_register_fundamental (g_type_fundamental_next (), g_type_register_fundamental (g_type_fundamental_next (),
I_("ClutterUnit"), I_("ClutterUnit"),
&_info, &_finfo, 0); &_info, &_finfo, 0);
g_value_register_transform_func (_clutter_unit_type, G_TYPE_INT,
clutter_value_transform_unit_int);
} }
return _clutter_unit_type; return _clutter_unit_type;