From: Matthew Allum Date: Fri, 25 May 2007 16:35:57 +0000 (+0000) Subject: 2007-05-25 Matthew Allum X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a64b6b7ee7a848d090fd010cc2333655b15f5223;p=profile%2Fivi%2Fclutter.git 2007-05-25 Matthew Allum * clutter/clutter-color.c: (clutter_color_parse): Handle #rrggbbaa color setting strings (i.e with alpha). Set alpha to 0xff if it is not specified. * clutter/clutter-stage.c: (clutter_stage_get_actor_at_pos) Increase select buffer. * examples/super-oh.c: Fix up use of clutter_group_show_all() --- diff --git a/ChangeLog b/ChangeLog index e47af35..822073e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-05-25 Matthew Allum + + * clutter/clutter-color.c: (clutter_color_parse): + Handle #rrggbbaa color setting strings (i.e with alpha). + Set alpha to 0xff if it is not specified. + + * clutter/clutter-stage.c: (clutter_stage_get_actor_at_pos) + Increase select buffer. + + * examples/super-oh.c: + Fix up use of clutter_group_show_all() + 2007-05-25 Tomas Frydrych * clutter/clutter-actor.c: diff --git a/clutter/clutter-color.c b/clutter/clutter-color.c index d32f091..7f2564d 100644 --- a/clutter/clutter-color.c +++ b/clutter/clutter-color.c @@ -452,17 +452,17 @@ clutter_color_from_pixel (ClutterColor *dest, /** * clutter_color_parse: - * @color: a string specifiying a color + * @color: a string specifiying a color (named color or #RRGGBBAA) * @dest: return location for a #ClutterColor * * Parses a string definition of a color, filling the - * red, green and - * blue channels of @dest. The - * alpha channel is not changed. The - * color in @dest is not allocated. + * red, green, + * blue and alpha + * channels of @dest. If alpha is not specified it will be set full opaque. + * The color in @dest is not allocated. * * The color may be defined by any of the formats understood by - * XParseColor; these include literal color + * pango_color_parse; these include literal color * names, like Red or DarkSlateGray, * or hexadecimal specifications like #3050b2 or * #333. @@ -477,16 +477,43 @@ clutter_color_parse (const gchar *color, { PangoColor pango_color; + /* parse ourselves to get alpha */ + if (color[0] == '#') + { + gint32 result; + + if (sscanf (color+1, "%x", &result)) + { + if (strlen(color) == 9) + { + dest->red = result >> 24 & 0xff; + dest->green = (result >> 16) & 0xff; + dest->blue = (result >> 8) & 0xff; + dest->alpha = result & 0xff; + return TRUE; + } + else if (strlen(color) == 7) + { + dest->red = (result >> 16) & 0xff; + dest->green = (result >> 8) & 0xff; + dest->blue = result & 0xff; + dest->alpha = 0xff; + return TRUE; + } + } + } + + /* Fall back to pango for named colors - note pango does not handle alpha */ if (pango_color_parse (&pango_color, color)) { - dest->red = pango_color.red; + dest->red = pango_color.red; dest->green = pango_color.green; - dest->blue = pango_color.blue; - + dest->blue = pango_color.blue; + dest->alpha = 0xff; return TRUE; } - else - return FALSE; + + return FALSE; } /** diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 918bfa1..083ea7e 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -773,21 +773,17 @@ clutter_stage_get_actor_at_pos (ClutterStage *stage, */ ClutterActor *found = NULL; - GLuint buff[64] = { 0 }; + GLuint buff[512] = { 0 }; GLint hits; GLint view[4]; - ClutterMainContext *ctx; g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL); - ctx = clutter_context_get_default (); - - glSelectBuffer (sizeof (buff), buff); + glSelectBuffer (512, buff); glGetIntegerv (GL_VIEWPORT, view); glRenderMode (GL_SELECT); glInitNames (); - glPushName (0); glMatrixMode (GL_PROJECTION); diff --git a/examples/super-oh.c b/examples/super-oh.c index 8dbde9c..23256b1 100644 --- a/examples/super-oh.c +++ b/examples/super-oh.c @@ -248,12 +248,15 @@ main (int argc, char *argv[]) } #endif + clutter_actor_show_all (oh->group); + /* Add the group to the stage */ clutter_group_add (CLUTTER_GROUP (stage), CLUTTER_ACTOR(oh->group)); /* Show everying ( and map window ) */ clutter_actor_show_all (stage); + g_signal_connect (stage, "button-press-event", G_CALLBACK (input_cb), oh);