From 0ca514a35f7d0a4d3e4ceb303a29af5a88c6ba51 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 18 Mar 2008 17:56:50 +0000 Subject: [PATCH] 2008-03-18 Emmanuele Bassi * clutter/clutter-texture.c: Small clean ups in the coding style. --- ChangeLog | 4 ++++ clutter/clutter-texture.c | 47 ++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5728be847..04fbd07f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-03-18 Emmanuele Bassi + + * clutter/clutter-texture.c: Small clean ups in the coding style. + 2008-03-18 Emmanuele Bassi * clutter.symbols: Add new symbols diff --git a/clutter/clutter-texture.c b/clutter/clutter-texture.c index 30b7d594e..8b51c9181 100644 --- a/clutter/clutter-texture.c +++ b/clutter/clutter-texture.c @@ -1564,8 +1564,8 @@ clutter_texture_set_from_rgb_data (ClutterTexture *texture, g_signal_emit (texture, texture_signals[PIXBUF_CHANGE], 0); /* If resized actor may need resizing but paint() will do this */ - if (CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR(texture))) - clutter_actor_queue_redraw (CLUTTER_ACTOR(texture)); + if (CLUTTER_ACTOR_IS_MAPPED (texture)) + clutter_actor_queue_redraw (CLUTTER_ACTOR (texture)); if (copy_data != NULL) g_free (copy_data); @@ -1729,10 +1729,10 @@ clutter_texture_set_pixbuf (ClutterTexture *texture, { ClutterTexturePrivate *priv; - priv = texture->priv; - g_return_val_if_fail (pixbuf != NULL, FALSE); + priv = texture->priv; + return clutter_texture_set_from_rgb_data (texture, gdk_pixbuf_get_pixels (pixbuf), gdk_pixbuf_get_has_alpha (pixbuf), @@ -1755,11 +1755,7 @@ clutter_texture_set_pixbuf (ClutterTexture *texture, ClutterActor* clutter_texture_new_from_pixbuf (GdkPixbuf *pixbuf) { - ClutterTexture *texture; - - texture = g_object_new (CLUTTER_TYPE_TEXTURE, "pixbuf", pixbuf, NULL); - - return CLUTTER_ACTOR(texture); + return g_object_new (CLUTTER_TYPE_TEXTURE, "pixbuf", pixbuf, NULL); } /** @@ -1789,12 +1785,14 @@ clutter_texture_get_base_size (ClutterTexture *texture, gint *width, gint *height) { + g_return_if_fail (CLUTTER_IS_TEXTURE (texture)); + /* Attempt to realize, mainly for subclasses ( such as labels ) - * which maynot create pixbuf data and thus base size until + * which may not create pixbuf data and thus base size until * realization happens. - */ - if (!CLUTTER_ACTOR_IS_REALIZED(CLUTTER_ACTOR(texture))) - clutter_actor_realize (CLUTTER_ACTOR(texture)); + */ + if (!CLUTTER_ACTOR_IS_REALIZED (texture)) + clutter_actor_realize (CLUTTER_ACTOR (texture)); if (width) *width = texture->priv->width; @@ -1843,6 +1841,8 @@ clutter_texture_get_n_tiles (ClutterTexture *texture, gint *n_x_tiles, gint *n_y_tiles) { + g_return_if_fail (CLUTTER_IS_TEXTURE (texture)); + if (n_x_tiles) *n_x_tiles = texture->priv->n_x_tiles; @@ -1871,16 +1871,21 @@ clutter_texture_get_x_tile_detail (ClutterTexture *texture, gint *size, gint *waste) { - g_return_if_fail(x_index < texture->priv->n_x_tiles); + ClutterTexturePrivate *priv; + + g_return_if_fail (CLUTTER_IS_TEXTURE (texture)); + g_return_if_fail (x_index < texture->priv->n_x_tiles); + + priv = texture->priv; if (pos) - *pos = texture->priv->x_tiles[x_index].pos; + *pos = priv->x_tiles[x_index].pos; if (size) - *size = texture->priv->x_tiles[x_index].size; + *size = priv->x_tiles[x_index].size; if (waste) - *waste = texture->priv->x_tiles[x_index].waste; + *waste = priv->x_tiles[x_index].waste; } /** @@ -1937,7 +1942,7 @@ clutter_texture_has_generated_tiles (ClutterTexture *texture) { g_return_val_if_fail (CLUTTER_IS_TEXTURE (texture), FALSE); - return (texture->priv->tiles != NULL); + return texture->priv->tiles != NULL; } /** @@ -2308,12 +2313,12 @@ on_fbo_parent_change (ClutterActor *actor, * sized large enough to contain any child tranformations. * * - * Uploading pixel data to the texture (e.g by - * #clutter_actor_set_pixbuf) will destroy the offscreen texture data + * Uploading pixel data to the texture (e.g by using + * clutter_actor_set_pixbuf()) will destroy the offscreen texture data * and end redirection. * * - * #clutter_texture_get_pixbuf can be used to read the offscreen + * clutter_texture_get_pixbuf() can be used to read the offscreen * texture pixels into a pixbuf. * *