mirror of
https://github.com/brl/mutter.git
synced 2025-03-03 19:58:10 +00:00
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:
parent
0e2b0e496e
commit
abef73bb58
@ -199,7 +199,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect)
|
|||||||
vertex->y = height * vertex->ty;
|
vertex->y = height * vertex->ty;
|
||||||
vertex->z = 0.0f;
|
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);
|
_clutter_deform_effect_deform_vertex (self, width, height, vertex);
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ _clutter_do_pick (ClutterStage *stage,
|
|||||||
is_clipped ? "clippped" : "full", x, y);
|
is_clipped ? "clippped" : "full", x, y);
|
||||||
|
|
||||||
cogl_disable_fog ();
|
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);
|
CLUTTER_TIMER_START (_clutter_uprof_context, pick_clear);
|
||||||
cogl_clear (&stage_pick_id,
|
cogl_clear (&stage_pick_id,
|
||||||
COGL_BUFFER_BIT_COLOR |
|
COGL_BUFFER_BIT_COLOR |
|
||||||
|
@ -287,7 +287,7 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect)
|
|||||||
perspective.z_near,
|
perspective.z_near,
|
||||||
perspective.z_far);
|
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_clear (&transparent,
|
||||||
COGL_BUFFER_BIT_COLOR |
|
COGL_BUFFER_BIT_COLOR |
|
||||||
COGL_BUFFER_BIT_DEPTH);
|
COGL_BUFFER_BIT_DEPTH);
|
||||||
|
@ -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
|
/* Add a gradient that makes it look like lighting and hides the switch
|
||||||
* between textures.
|
* 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)
|
if (rx > 0)
|
||||||
|
@ -316,11 +316,11 @@ clutter_stage_paint (ClutterActor *self)
|
|||||||
/* we use the real alpha to clear the stage if :use-alpha is
|
/* we use the real alpha to clear the stage if :use-alpha is
|
||||||
* set; the effect depends entirely on how the Clutter backend
|
* set; the effect depends entirely on how the Clutter backend
|
||||||
*/
|
*/
|
||||||
cogl_color_set_from_4ub (&stage_color,
|
cogl_color_init_from_4ub (&stage_color,
|
||||||
priv->color.red,
|
priv->color.red,
|
||||||
priv->color.green,
|
priv->color.green,
|
||||||
priv->color.blue,
|
priv->color.blue,
|
||||||
priv->use_alpha ? real_alpha
|
priv->use_alpha ? real_alpha
|
||||||
: 255);
|
: 255);
|
||||||
cogl_color_premultiply (&stage_color);
|
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 */
|
* /* set the fog color to the stage background color */
|
||||||
* clutter_stage_get_color (CLUTTER_STAGE (actor), &stage_color);
|
* clutter_stage_get_color (CLUTTER_STAGE (actor), &stage_color);
|
||||||
* cogl_color_set_from_4ub (&fog_color,
|
* cogl_color_init_from_4ub (&fog_color,
|
||||||
* stage_color.red,
|
* stage_color.red,
|
||||||
* stage_color.green,
|
* stage_color.green,
|
||||||
* stage_color.blue,
|
* stage_color.blue,
|
||||||
* stage_color.alpha);
|
* stage_color.alpha);
|
||||||
*
|
*
|
||||||
* /* enable fog */
|
* /* enable fog */
|
||||||
* cogl_set_fog (&fog_color,
|
* 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
|
* <note>The fogging functions only work correctly when the visible actors use
|
||||||
* unmultiplied alpha colors. By default Cogl will premultiply textures
|
* unmultiplied alpha colors. By default Cogl will premultiply textures and
|
||||||
* and cogl_set_source_color will premultiply colors, so unless you
|
* cogl_set_source_color() will premultiply colors, so unless you explicitly
|
||||||
* explicitly load your textures requesting an unmultiplied
|
* load your textures requesting an unmultiplied internal format and use
|
||||||
* internal_format and use cogl_material_set_color you can only use
|
* cogl_material_set_color() you can only use fogging with fully opaque actors.
|
||||||
* fogging with fully opaque actors.
|
* Support for premultiplied colors will improve in the future when we can
|
||||||
*
|
* depend on fragment shaders.</note>
|
||||||
* We can look to improve this in the future when we can depend on
|
|
||||||
* fragment shaders.
|
|
||||||
*
|
*
|
||||||
* Since: 0.6
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
|
@ -1903,11 +1903,11 @@ clutter_text_paint (ClutterActor *self)
|
|||||||
|
|
||||||
CLUTTER_NOTE (PAINT, "painting text (text: '%s')", priv->text);
|
CLUTTER_NOTE (PAINT, "painting text (text: '%s')", priv->text);
|
||||||
|
|
||||||
cogl_color_set_from_4ub (&color,
|
cogl_color_init_from_4ub (&color,
|
||||||
priv->text_color.red,
|
priv->text_color.red,
|
||||||
priv->text_color.green,
|
priv->text_color.green,
|
||||||
priv->text_color.blue,
|
priv->text_color.blue,
|
||||||
real_opacity);
|
real_opacity);
|
||||||
cogl_pango_render_layout (layout, text_x, 0, &color, 0);
|
cogl_pango_render_layout (layout, text_x, 0, &color, 0);
|
||||||
|
|
||||||
if (clip_set)
|
if (clip_set)
|
||||||
|
@ -511,7 +511,7 @@ update_fbo (ClutterActor *self)
|
|||||||
|
|
||||||
|
|
||||||
/* cogl_clear is called to clear the buffers */
|
/* 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_clear (&transparent_col,
|
||||||
COGL_BUFFER_BIT_COLOR |
|
COGL_BUFFER_BIT_COLOR |
|
||||||
COGL_BUFFER_BIT_DEPTH);
|
COGL_BUFFER_BIT_DEPTH);
|
||||||
@ -615,11 +615,11 @@ clutter_texture_pick (ClutterActor *self,
|
|||||||
if (priv->fbo_handle != COGL_INVALID_HANDLE)
|
if (priv->fbo_handle != COGL_INVALID_HANDLE)
|
||||||
update_fbo (self);
|
update_fbo (self);
|
||||||
|
|
||||||
cogl_color_set_from_4ub (&pick_color,
|
cogl_color_init_from_4ub (&pick_color,
|
||||||
color->red,
|
color->red,
|
||||||
color->green,
|
color->green,
|
||||||
color->blue,
|
color->blue,
|
||||||
0xff);
|
0xff);
|
||||||
cogl_material_set_layer_combine_constant (priv->pick_material,
|
cogl_material_set_layer_combine_constant (priv->pick_material,
|
||||||
0, &pick_color);
|
0, &pick_color);
|
||||||
cogl_material_set_layer (priv->pick_material, 0,
|
cogl_material_set_layer (priv->pick_material, 0,
|
||||||
|
@ -3530,7 +3530,7 @@ cogl_material_set_color4ub (CoglMaterial *material,
|
|||||||
guint8 alpha)
|
guint8 alpha)
|
||||||
{
|
{
|
||||||
CoglColor color;
|
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);
|
cogl_material_set_color (material, &color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3542,7 +3542,7 @@ cogl_material_set_color4f (CoglMaterial *material,
|
|||||||
float alpha)
|
float alpha)
|
||||||
{
|
{
|
||||||
CoglColor color;
|
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);
|
cogl_material_set_color (material, &color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1048,7 @@ cogl_set_source_texture (CoglHandle texture_handle)
|
|||||||
g_return_if_fail (texture_handle != NULL);
|
g_return_if_fail (texture_handle != NULL);
|
||||||
|
|
||||||
cogl_material_set_layer (ctx->simple_material, 0, texture_handle);
|
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_material_set_color (ctx->simple_material, &white);
|
||||||
cogl_set_source (ctx->simple_material);
|
cogl_set_source (ctx->simple_material);
|
||||||
}
|
}
|
||||||
@ -1061,7 +1061,7 @@ cogl_set_source_color4ub (guint8 red,
|
|||||||
{
|
{
|
||||||
CoglColor c = { 0, };
|
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);
|
cogl_set_source_color (&c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,7 +1073,7 @@ cogl_set_source_color4f (float red,
|
|||||||
{
|
{
|
||||||
CoglColor c = { 0, };
|
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);
|
cogl_set_source_color (&c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,11 +337,11 @@ _cogl_pango_display_list_render (CoglPangoDisplayList *dl,
|
|||||||
if (node->color_override)
|
if (node->color_override)
|
||||||
/* Use the override color but preserve the alpha from the
|
/* Use the override color but preserve the alpha from the
|
||||||
draw color */
|
draw color */
|
||||||
cogl_color_set_from_4ub (&draw_color,
|
cogl_color_init_from_4ub (&draw_color,
|
||||||
cogl_color_get_red_byte (&node->color),
|
cogl_color_get_red_byte (&node->color),
|
||||||
cogl_color_get_green_byte (&node->color),
|
cogl_color_get_green_byte (&node->color),
|
||||||
cogl_color_get_blue_byte (&node->color),
|
cogl_color_get_blue_byte (&node->color),
|
||||||
cogl_color_get_alpha_byte (color));
|
cogl_color_get_alpha_byte (color));
|
||||||
else
|
else
|
||||||
draw_color = *color;
|
draw_color = *color;
|
||||||
cogl_color_premultiply (&draw_color);
|
cogl_color_premultiply (&draw_color);
|
||||||
|
@ -569,11 +569,11 @@ cogl_pango_renderer_set_color_for_part (PangoRenderer *renderer,
|
|||||||
{
|
{
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
|
|
||||||
cogl_color_set_from_4ub (&color,
|
cogl_color_init_from_4ub (&color,
|
||||||
pango_color->red >> 8,
|
pango_color->red >> 8,
|
||||||
pango_color->green >> 8,
|
pango_color->green >> 8,
|
||||||
pango_color->blue >> 8,
|
pango_color->blue >> 8,
|
||||||
0xff);
|
0xff);
|
||||||
|
|
||||||
_cogl_pango_display_list_set_color_override (priv->display_list, &color);
|
_cogl_pango_display_list_set_color_override (priv->display_list, &color);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ _text_paint_cb (ClutterActor *actor)
|
|||||||
|
|
||||||
/* Create a #ccc color and premultiply it */
|
/* Create a #ccc color and premultiply it */
|
||||||
CoglColor color;
|
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);
|
cogl_color_premultiply (&color);
|
||||||
|
|
||||||
/* Finally, render the Text layout at a given offset using the color */
|
/* Finally, render the Text layout at a given offset using the color */
|
||||||
|
@ -50,7 +50,7 @@ _update_progress_cb (ClutterTimeline *timeline,
|
|||||||
* depending on the current progress of the timeline
|
* depending on the current progress of the timeline
|
||||||
*/
|
*/
|
||||||
CoglColor constant;
|
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
|
/* This sets the value of the constant color we use when combining
|
||||||
* the two layers
|
* the two layers
|
||||||
|
@ -35,9 +35,9 @@ _clone_paint_cb (ClutterActor *actor)
|
|||||||
/* figure out the two colors for the reflection: the first is
|
/* figure out the two colors for the reflection: the first is
|
||||||
* full color and the second is the same, but at 0 opacity
|
* 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_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);
|
cogl_color_premultiply (&color_2);
|
||||||
|
|
||||||
/* now describe the four vertices of the quad; since it has
|
/* now describe the four vertices of the quad; since it has
|
||||||
|
@ -677,9 +677,9 @@ _clone_paint_cb (ClutterActor *actor)
|
|||||||
/* figure out the two colors for the reflection: the first is
|
/* figure out the two colors for the reflection: the first is
|
||||||
* full color and the second is the same, but at 0 opacity
|
* 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_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);
|
cogl_color_premultiply (&color_2);
|
||||||
|
|
||||||
/* describe the four vertices of the quad; since it has
|
/* describe the four vertices of the quad; since it has
|
||||||
|
@ -204,7 +204,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
|||||||
CoglMatrix stage_projection;
|
CoglMatrix stage_projection;
|
||||||
CoglMatrix stage_modelview;
|
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);
|
do_test_backface_culling (state);
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ test_blend (TestState *state,
|
|||||||
blend_string, error->message);
|
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_material_set_blend_constant (material, &blend_const_color);
|
||||||
|
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
@ -232,7 +232,7 @@ test_tex_combine (TestState *state,
|
|||||||
combine_string, error->message);
|
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_material_set_layer_combine_constant (material, 1, &combine_const_color);
|
||||||
|
|
||||||
cogl_set_source (material);
|
cogl_set_source (material);
|
||||||
|
@ -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
|
/* ignore the fallback texture on the layer and use a constant color
|
||||||
instead */
|
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,
|
cogl_material_set_layer_combine (material, 0,
|
||||||
"RGBA=REPLACE(CONSTANT)",
|
"RGBA=REPLACE(CONSTANT)",
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -82,7 +82,7 @@ on_paint (ClutterActor *actor, void *state)
|
|||||||
float height;
|
float height;
|
||||||
|
|
||||||
/* for clearing the offscreen framebuffer to black... */
|
/* 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_viewport (saved_viewport);
|
||||||
cogl_get_projection_matrix (&saved_projection);
|
cogl_get_projection_matrix (&saved_projection);
|
||||||
|
@ -56,7 +56,7 @@ on_paint (ClutterActor *actor,
|
|||||||
layout = clutter_actor_create_pango_layout (actor, text);
|
layout = clutter_actor_create_pango_layout (actor, text);
|
||||||
pango_layout_get_size (layout, &layout_width, &layout_height);
|
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,
|
cogl_pango_render_layout (layout,
|
||||||
(width - (layout_width / 1024)) / 2,
|
(width - (layout_width / 1024)) / 2,
|
||||||
(height - (layout_height / 1024)) / 2,
|
(height - (layout_height / 1024)) / 2,
|
||||||
|
@ -114,11 +114,11 @@ test_coglbox_fade_texture (gfloat x1,
|
|||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
cogl_color_set_from_4ub (&(vertices[i].color),
|
cogl_color_init_from_4ub (&(vertices[i].color),
|
||||||
255,
|
255,
|
||||||
255,
|
255,
|
||||||
255,
|
255,
|
||||||
((i ^ (i >> 1)) & 1) ? 0 : 128);
|
((i ^ (i >> 1)) & 1) ? 0 : 128);
|
||||||
cogl_color_premultiply (&(vertices[i].color));
|
cogl_color_premultiply (&(vertices[i].color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user