Replace cogl_color_set_from_* with cogl_color_init_from_*

The former is not yet "officially" deprecated by the latter, but it's
confusing to have them both in the code base.
This commit is contained in:
Emmanuele Bassi
2010-09-03 16:55:12 +01:00
parent 0e2b0e496e
commit abef73bb58
21 changed files with 64 additions and 66 deletions

View File

@ -199,7 +199,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
vertex->y = height * vertex->ty;
vertex->z = 0.0f;
cogl_color_set_from_4ub (&vertex->color, 255, 255, 255, opacity);
cogl_color_init_from_4ub (&vertex->color, 255, 255, 255, opacity);
_clutter_deform_effect_deform_vertex (self, width, height, vertex);
}

View File

@ -680,7 +680,7 @@ _clutter_do_pick (ClutterStage *stage,
is_clipped ? "clippped" : "full", x, y);
cogl_disable_fog ();
cogl_color_set_from_4ub (&stage_pick_id, 255, 255, 255, 255);
cogl_color_init_from_4ub (&stage_pick_id, 255, 255, 255, 255);
CLUTTER_TIMER_START (_clutter_uprof_context, pick_clear);
cogl_clear (&stage_pick_id,
COGL_BUFFER_BIT_COLOR |

View File

@ -287,7 +287,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
perspective.z_near,
perspective.z_far);
cogl_color_set_from_4ub (&transparent, 0, 0, 0, 0);
cogl_color_init_from_4ub (&transparent, 0, 0, 0, 0);
cogl_clear (&transparent,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH);

View File

@ -121,7 +121,7 @@ clutter_page_turn_effect_deform_vertex (ClutterDeformEffect *effect,
/* Add a gradient that makes it look like lighting and hides the switch
* between textures.
*/
cogl_color_set_from_4ub (&vertex->color, shade, shade, shade, 0xff);
cogl_color_init_from_4ub (&vertex->color, shade, shade, shade, 0xff);
}
if (rx > 0)

View File

@ -316,11 +316,11 @@ clutter_stage_paint (ClutterActor *self)
/* we use the real alpha to clear the stage if :use-alpha is
* set; the effect depends entirely on how the Clutter backend
*/
cogl_color_set_from_4ub (&stage_color,
priv->color.red,
priv->color.green,
priv->color.blue,
priv->use_alpha ? real_alpha
cogl_color_init_from_4ub (&stage_color,
priv->color.red,
priv->color.green,
priv->color.blue,
priv->use_alpha ? real_alpha
: 255);
cogl_color_premultiply (&stage_color);
@ -2082,11 +2082,11 @@ clutter_stage_set_use_fog (ClutterStage *stage,
*
* /* set the fog color to the stage background color */
* clutter_stage_get_color (CLUTTER_STAGE (actor), &stage_color);
* cogl_color_set_from_4ub (&fog_color,
* stage_color.red,
* stage_color.green,
* stage_color.blue,
* stage_color.alpha);
* cogl_color_init_from_4ub (&fog_color,
* stage_color.red,
* stage_color.green,
* stage_color.blue,
* stage_color.alpha);
*
* /* enable fog */
* cogl_set_fog (&fog_color,
@ -2096,15 +2096,13 @@ clutter_stage_set_use_fog (ClutterStage *stage,
* }
* ]|
*
* Note: The fogging functions only work correctly when the visible actors use
* unmultiplied alpha colors. By default Cogl will premultiply textures
* and cogl_set_source_color will premultiply colors, so unless you
* explicitly load your textures requesting an unmultiplied
* internal_format and use cogl_material_set_color you can only use
* fogging with fully opaque actors.
*
* We can look to improve this in the future when we can depend on
* fragment shaders.
* <note>The fogging functions only work correctly when the visible actors use
* unmultiplied alpha colors. By default Cogl will premultiply textures and
* cogl_set_source_color() will premultiply colors, so unless you explicitly
* load your textures requesting an unmultiplied internal format and use
* cogl_material_set_color() you can only use fogging with fully opaque actors.
* Support for premultiplied colors will improve in the future when we can
* depend on fragment shaders.</note>
*
* Since: 0.6
*/

View File

@ -1903,11 +1903,11 @@ clutter_text_paint (ClutterActor *self)
CLUTTER_NOTE (PAINT, "painting text (text: '%s')", priv->text);
cogl_color_set_from_4ub (&color,
priv->text_color.red,
priv->text_color.green,
priv->text_color.blue,
real_opacity);
cogl_color_init_from_4ub (&color,
priv->text_color.red,
priv->text_color.green,
priv->text_color.blue,
real_opacity);
cogl_pango_render_layout (layout, text_x, 0, &color, 0);
if (clip_set)

View File

@ -511,7 +511,7 @@ update_fbo (ClutterActor *self)
/* cogl_clear is called to clear the buffers */
cogl_color_set_from_4ub (&transparent_col, 0, 0, 0, 0);
cogl_color_init_from_4ub (&transparent_col, 0, 0, 0, 0);
cogl_clear (&transparent_col,
COGL_BUFFER_BIT_COLOR |
COGL_BUFFER_BIT_DEPTH);
@ -615,11 +615,11 @@ clutter_texture_pick (ClutterActor *self,
if (priv->fbo_handle != COGL_INVALID_HANDLE)
update_fbo (self);
cogl_color_set_from_4ub (&pick_color,
color->red,
color->green,
color->blue,
0xff);
cogl_color_init_from_4ub (&pick_color,
color->red,
color->green,
color->blue,
0xff);
cogl_material_set_layer_combine_constant (priv->pick_material,
0, &pick_color);
cogl_material_set_layer (priv->pick_material, 0,

View File

@ -3530,7 +3530,7 @@ cogl_material_set_color4ub (CoglMaterial *material,
guint8 alpha)
{
CoglColor color;
cogl_color_set_from_4ub (&color, red, green, blue, alpha);
cogl_color_init_from_4ub (&color, red, green, blue, alpha);
cogl_material_set_color (material, &color);
}
@ -3542,7 +3542,7 @@ cogl_material_set_color4f (CoglMaterial *material,
float alpha)
{
CoglColor color;
cogl_color_set_from_4f (&color, red, green, blue, alpha);
cogl_color_init_from_4f (&color, red, green, blue, alpha);
cogl_material_set_color (material, &color);
}

View File

@ -1048,7 +1048,7 @@ cogl_set_source_texture (CoglHandle texture_handle)
g_return_if_fail (texture_handle != NULL);
cogl_material_set_layer (ctx->simple_material, 0, texture_handle);
cogl_color_set_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
cogl_color_init_from_4ub (&white, 0xff, 0xff, 0xff, 0xff);
cogl_material_set_color (ctx->simple_material, &white);
cogl_set_source (ctx->simple_material);
}
@ -1061,7 +1061,7 @@ cogl_set_source_color4ub (guint8 red,
{
CoglColor c = { 0, };
cogl_color_set_from_4ub (&c, red, green, blue, alpha);
cogl_color_init_from_4ub (&c, red, green, blue, alpha);
cogl_set_source_color (&c);
}
@ -1073,7 +1073,7 @@ cogl_set_source_color4f (float red,
{
CoglColor c = { 0, };
cogl_color_set_from_4f (&c, red, green, blue, alpha);
cogl_color_init_from_4f (&c, red, green, blue, alpha);
cogl_set_source_color (&c);
}

View File

@ -337,11 +337,11 @@ _cogl_pango_display_list_render (CoglPangoDisplayList *dl,
if (node->color_override)
/* Use the override color but preserve the alpha from the
draw color */
cogl_color_set_from_4ub (&draw_color,
cogl_color_get_red_byte (&node->color),
cogl_color_get_green_byte (&node->color),
cogl_color_get_blue_byte (&node->color),
cogl_color_get_alpha_byte (color));
cogl_color_init_from_4ub (&draw_color,
cogl_color_get_red_byte (&node->color),
cogl_color_get_green_byte (&node->color),
cogl_color_get_blue_byte (&node->color),
cogl_color_get_alpha_byte (color));
else
draw_color = *color;
cogl_color_premultiply (&draw_color);

View File

@ -569,11 +569,11 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
{
CoglColor color;
cogl_color_set_from_4ub (&color,
pango_color->red >> 8,
pango_color->green >> 8,
pango_color->blue >> 8,
0xff);
cogl_color_init_from_4ub (&color,
pango_color->red >> 8,
pango_color->green >> 8,
pango_color->blue >> 8,
0xff);
_cogl_pango_display_list_set_color_override (priv->display_list, &color);
}