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);
}

View File

@ -27,7 +27,7 @@ _text_paint_cb (ClutterActor *actor)
/* Create a #ccc color and premultiply it */
CoglColor color;
cogl_color_set_from_4ub (&color, 0xcc, 0xcc, 0xcc, real_opacity);
cogl_color_init_from_4ub (&color, 0xcc, 0xcc, 0xcc, real_opacity);
cogl_color_premultiply (&color);
/* Finally, render the Text layout at a given offset using the color */

View File

@ -50,7 +50,7 @@ _update_progress_cb (ClutterTimeline *timeline,
* depending on the current progress of the timeline
*/
CoglColor constant;
cogl_color_set_from_4ub (&constant, 0x00, 0x00, 0x00, 0xff * progress);
cogl_color_init_from_4ub (&constant, 0x00, 0x00, 0x00, 0xff * progress);
/* This sets the value of the constant color we use when combining
* the two layers

View File

@ -35,9 +35,9 @@ _clone_paint_cb (ClutterActor *actor)
/* figure out the two colors for the reflection: the first is
* full color and the second is the same, but at 0 opacity
*/
cogl_color_set_from_4f (&color_1, 1.0, 1.0, 1.0, opacity / 255.);
cogl_color_init_from_4f (&color_1, 1.0, 1.0, 1.0, opacity / 255.);
cogl_color_premultiply (&color_1);
cogl_color_set_from_4f (&color_2, 1.0, 1.0, 1.0, 0.0);
cogl_color_init_from_4f (&color_2, 1.0, 1.0, 1.0, 0.0);
cogl_color_premultiply (&color_2);
/* now describe the four vertices of the quad; since it has

View File

@ -677,9 +677,9 @@ _clone_paint_cb (ClutterActor *actor)
/* figure out the two colors for the reflection: the first is
* full color and the second is the same, but at 0 opacity
*/
cogl_color_set_from_4f (&color_1, 1.0, 1.0, 1.0, opacity / 255.);
cogl_color_init_from_4f (&color_1, 1.0, 1.0, 1.0, opacity / 255.);
cogl_color_premultiply (&color_1);
cogl_color_set_from_4f (&color_2, 1.0, 1.0, 1.0, 0.0);
cogl_color_init_from_4f (&color_2, 1.0, 1.0, 1.0, 0.0);
cogl_color_premultiply (&color_2);
/* describe the four vertices of the quad; since it has

View File

@ -204,7 +204,7 @@ on_paint (ClutterActor *actor, TestState *state)
CoglMatrix stage_projection;
CoglMatrix stage_modelview;
cogl_color_set_from_4ub (&clr, 0x00, 0x00, 0x00, 0xff);
cogl_color_init_from_4ub (&clr, 0x00, 0x00, 0x00, 0xff);
do_test_backface_culling (state);

View File

@ -111,7 +111,7 @@ test_blend (TestState *state,
blend_string, error->message);
}
cogl_color_set_from_4ub (&blend_const_color, Br, Bg, Bb, Ba);
cogl_color_init_from_4ub (&blend_const_color, Br, Bg, Bb, Ba);
cogl_material_set_blend_constant (material, &blend_const_color);
cogl_set_source (material);
@ -232,7 +232,7 @@ test_tex_combine (TestState *state,
combine_string, error->message);
}
cogl_color_set_from_4ub (&combine_const_color, Cr, Cg, Cb, Ca);
cogl_color_init_from_4ub (&combine_const_color, Cr, Cg, Cb, Ca);
cogl_material_set_layer_combine_constant (material, 1, &combine_const_color);
cogl_set_source (material);

View File

@ -200,7 +200,7 @@ test_invalid_texture_layers_with_constant_colors (TestState *state,
/* ignore the fallback texture on the layer and use a constant color
instead */
cogl_color_set_from_4ub (&constant_color, 0, 0, 255, 255);
cogl_color_init_from_4ub (&constant_color, 0, 0, 255, 255);
cogl_material_set_layer_combine (material, 0,
"RGBA=REPLACE(CONSTANT)",
NULL);

View File

@ -82,7 +82,7 @@ on_paint (ClutterActor *actor, void *state)
float height;
/* for clearing the offscreen framebuffer to black... */
cogl_color_set_from_4ub (&black, 0x00, 0x00, 0x00, 0xff);
cogl_color_init_from_4ub (&black, 0x00, 0x00, 0x00, 0xff);
cogl_get_viewport (saved_viewport);
cogl_get_projection_matrix (&saved_projection);

View File

@ -56,7 +56,7 @@ on_paint (ClutterActor *actor,
layout = clutter_actor_create_pango_layout (actor, text);
pango_layout_get_size (layout, &layout_width, &layout_height);
cogl_color_set_from_4ub (&color, 0, 0, 0, 255);
cogl_color_init_from_4ub (&color, 0, 0, 0, 255);
cogl_pango_render_layout (layout,
(width - (layout_width / 1024)) / 2,
(height - (layout_height / 1024)) / 2,

View File

@ -114,11 +114,11 @@ test_coglbox_fade_texture (gfloat x1,
for (i = 0; i < 4; i++)
{
cogl_color_set_from_4ub (&(vertices[i].color),
255,
255,
255,
((i ^ (i >> 1)) & 1) ? 0 : 128);
cogl_color_init_from_4ub (&(vertices[i].color),
255,
255,
255,
((i ^ (i >> 1)) & 1) ? 0 : 128);
cogl_color_premultiply (&(vertices[i].color));
}