2007-10-01 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-actor.c (clutter_actor_get_size): Implement
	get_size() as a wrapper around clutter_actor_query_coords()
	instead of calling g_object_get() twice.

	(clutter_actor_init): Initialise the box in one call.
This commit is contained in:
Emmanuele Bassi 2007-10-02 14:45:40 +00:00
parent 090c1d11b4
commit db0ed63c93
2 changed files with 28 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2007-10-01 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c (clutter_actor_get_size): Implement
get_size() as a wrapper around clutter_actor_query_coords()
instead of calling g_object_get() twice.
(clutter_actor_init): Initialise the box in one call.
2007-10-01 Emmanuele Bassi <ebassi@openedhand.com> 2007-10-01 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.[ch]: Remove the ::event-after signal * clutter/clutter-actor.[ch]: Remove the ::event-after signal

View File

@ -1451,17 +1451,19 @@ clutter_actor_class_init (ClutterActorClass *klass)
static void static void
clutter_actor_init (ClutterActor *self) clutter_actor_init (ClutterActor *self)
{ {
self->priv = CLUTTER_ACTOR_GET_PRIVATE (self); ClutterActorPrivate *priv;
ClutterActorBox box = { 0, };
self->priv->parent_actor = NULL; self->priv = priv = CLUTTER_ACTOR_GET_PRIVATE (self);
self->priv->has_clip = FALSE;
self->priv->opacity = 0xff;
self->priv->id = __id++;
self->priv->scale_x = CFX_ONE;
self->priv->scale_y = CFX_ONE;
clutter_actor_set_position (self, 0, 0); priv->parent_actor = NULL;
clutter_actor_set_size (self, 0, 0); priv->has_clip = FALSE;
priv->opacity = 0xff;
priv->id = __id++;
priv->scale_x = CFX_ONE;
priv->scale_y = CFX_ONE;
clutter_actor_request_coords (self, &box);
} }
/** /**
@ -1694,13 +1696,17 @@ clutter_actor_get_size (ClutterActor *self,
guint *width, guint *width,
guint *height) guint *height)
{ {
ClutterActorBox box;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_query_coords (self, &box);
if (width) if (width)
*width = clutter_actor_get_width (self); *width = CLUTTER_UNITS_TO_INT (box.x2 - box.x1);
if (height) if (height)
*height = clutter_actor_get_height (self); *height = CLUTTER_UNITS_TO_INT (box.y2 - box.y1);
} }
/* /*
@ -1968,13 +1974,13 @@ clutter_actor_set_scalex (ClutterActor *self,
{ {
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
self->priv->scale_x = scale_x;
self->priv->scale_y = scale_y;
g_object_ref (self); g_object_ref (self);
g_object_freeze_notify (G_OBJECT (self)); g_object_freeze_notify (G_OBJECT (self));
self->priv->scale_x = scale_x;
g_object_notify (G_OBJECT (self), "scale-x"); g_object_notify (G_OBJECT (self), "scale-x");
self->priv->scale_y = scale_y;
g_object_notify (G_OBJECT (self), "scale-y"); g_object_notify (G_OBJECT (self), "scale-y");
g_object_thaw_notify (G_OBJECT (self)); g_object_thaw_notify (G_OBJECT (self));