From 2c613df4ebceb7d23e0156233f019fb6c0cd55f5 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Mon, 29 Jan 2024 13:56:31 +0100 Subject: [PATCH] cogl: Drop Pipeline.set_color_* Those setters variants makes it very hard to do across project changes to the color type. As part of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544 I would like to switch from using integers to floats inside CoglColor which this PR would simplify Part-of: --- clutter/clutter/clutter-effect.c | 7 +++- clutter/clutter/clutter-offscreen-effect.c | 14 +++---- cogl/cogl/cogl-journal.c | 22 ++++++----- cogl/cogl/cogl-pipeline-state.c | 24 ------------ cogl/cogl/cogl-pipeline-state.h | 38 ------------------- src/backends/meta-stage-impl.c | 7 +++- src/compositor/meta-background-content.c | 12 +++--- src/compositor/meta-background.c | 17 +++++---- src/compositor/meta-shadow-factory.c | 7 +++- src/compositor/meta-shaped-texture.c | 8 +++- .../conform/actor-offscreen-redirect.c | 7 ++-- src/tests/clutter/conform/binding-pool.c | 4 +- .../clutter/interactive/test-binding-pool.c | 4 +- .../clutter/interactive/test-cogl-offscreen.c | 16 ++++++-- .../clutter/interactive/test-cogl-tex-tile.c | 4 +- .../clutter/micro-bench/test-cogl-perf.c | 24 +++++++----- .../cogl/conform/test-backface-culling.c | 6 ++- src/tests/cogl/conform/test-blend-strings.c | 19 +++++++--- .../cogl/conform/test-custom-attributes.c | 4 +- src/tests/cogl/conform/test-depth-test.c | 9 +++-- src/tests/cogl/conform/test-journal.c | 4 +- src/tests/cogl/conform/test-layer-remove.c | 3 +- src/tests/cogl/conform/test-multitexture.c | 6 ++- src/tests/cogl/conform/test-offscreen.c | 19 +++++++--- .../cogl/conform/test-pipeline-shader-state.c | 4 +- .../cogl/conform/test-point-size-attribute.c | 4 +- src/tests/cogl/conform/test-point-size.c | 4 +- .../cogl/conform/test-primitive-and-journal.c | 5 ++- src/tests/cogl/conform/test-primitive.c | 12 +++--- src/tests/cogl/conform/test-snippets.c | 29 ++++++++++---- src/tests/cogl/unit/test-pipeline-glsl.c | 4 +- 31 files changed, 191 insertions(+), 156 deletions(-) diff --git a/clutter/clutter/clutter-effect.c b/clutter/clutter/clutter-effect.c index a36e35031..29c39a1dc 100644 --- a/clutter/clutter/clutter-effect.c +++ b/clutter/clutter/clutter-effect.c @@ -97,6 +97,7 @@ * ClutterActor *actor) * { * MyEffect *self = MY_EFFECT (meta); + * CoglColor color; * * // Clear the previous state // * if (self->rect_1) @@ -120,11 +121,13 @@ * * // Create a red material * self->rect_1 = cogl_pipeline_new (); - * cogl_pipeline_set_color4f (self->rect_1, 1.0, 0.0, 0.0, 1.0); + * cogl_color_init_from_4f (&color, 1.0, 1.0, 1.0, 1.0); + * cogl_pipeline_set_color (self->rect_1, &color); * * // Create a green material * self->rect_2 = cogl_pipeline_new (); - * cogl_pipeline_set_color4f (self->rect_2, 0.0, 1.0, 0.0, 1.0); + * cogl_color_init_from_4f (&color, 0.0, 1.0, 0.0, 1.0); + * cogl_pipeline_set_color (self->rect_2, &color); * } * * static gboolean diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c index ac230da93..e8e3beea0 100644 --- a/clutter/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter/clutter-offscreen-effect.c @@ -424,15 +424,15 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect, ClutterOffscreenEffectPrivate *priv = clutter_offscreen_effect_get_instance_private (effect); ClutterPaintNode *pipeline_node; - guint8 paint_opacity; + float paint_opacity; + CoglColor color; - paint_opacity = clutter_actor_get_paint_opacity (priv->actor); + paint_opacity = clutter_actor_get_paint_opacity (priv->actor) / 255.0; - cogl_pipeline_set_color4ub (priv->pipeline, - paint_opacity, - paint_opacity, - paint_opacity, - paint_opacity); + cogl_color_init_from_4f (&color, + paint_opacity, paint_opacity, + paint_opacity, paint_opacity); + cogl_pipeline_set_color (priv->pipeline, &color); pipeline_node = clutter_pipeline_node_new (priv->pipeline); clutter_paint_node_set_static_name (pipeline_node, diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c index 6ea5d68d7..fa67358d9 100644 --- a/cogl/cogl/cogl-journal.c +++ b/cogl/cogl/cogl-journal.c @@ -344,9 +344,10 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start, if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES))) { static CoglPipeline *outline = NULL; - uint8_t color_intensity; + float color_intensity; int i; CoglAttribute *loop_attributes[1]; + CoglColor color; if (outline == NULL) outline = cogl_pipeline_new (ctx); @@ -358,15 +359,16 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start, in the order 0xff, 0xcc, 0x99, and 0x66. This gives a total of 24 colours. If there are more than 24 batches on the stage then it will wrap around */ - color_intensity = 0xff - 0x33 * (ctx->journal_rectangles_color >> 3); - cogl_pipeline_set_color4ub (outline, - (ctx->journal_rectangles_color & 1) ? - color_intensity : 0, - (ctx->journal_rectangles_color & 2) ? - color_intensity : 0, - (ctx->journal_rectangles_color & 4) ? - color_intensity : 0, - 0xff); + color_intensity = (0xff - 0x33 * (ctx->journal_rectangles_color >> 3) ) / 255.0; + cogl_color_init_from_4f (&color, + (ctx->journal_rectangles_color & 1) ? + color_intensity : 0.0, + (ctx->journal_rectangles_color & 2) ? + color_intensity : 0.0, + (ctx->journal_rectangles_color & 4) ? + color_intensity : 0.0, + 1.0); + cogl_pipeline_set_color (outline, &color); loop_attributes[0] = attributes[0]; /* we just want the position */ for (i = 0; i < batch_len; i++) diff --git a/cogl/cogl/cogl-pipeline-state.c b/cogl/cogl/cogl-pipeline-state.c index 9403a4bbe..2e879fbdc 100644 --- a/cogl/cogl/cogl-pipeline-state.c +++ b/cogl/cogl/cogl-pipeline-state.c @@ -368,30 +368,6 @@ cogl_pipeline_set_color (CoglPipeline *pipeline, pipeline->dirty_real_blend_enable = TRUE; } -void -cogl_pipeline_set_color4ub (CoglPipeline *pipeline, - uint8_t red, - uint8_t green, - uint8_t blue, - uint8_t alpha) -{ - CoglColor color; - cogl_color_init_from_4ub (&color, red, green, blue, alpha); - cogl_pipeline_set_color (pipeline, &color); -} - -void -cogl_pipeline_set_color4f (CoglPipeline *pipeline, - float red, - float green, - float blue, - float alpha) -{ - CoglColor color; - cogl_color_init_from_4f (&color, red, green, blue, alpha); - cogl_pipeline_set_color (pipeline, &color); -} - static void _cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline, CoglPipelineAlphaFunc alpha_func) diff --git a/cogl/cogl/cogl-pipeline-state.h b/cogl/cogl/cogl-pipeline-state.h index 9b7334d80..7effdc460 100644 --- a/cogl/cogl/cogl-pipeline-state.h +++ b/cogl/cogl/cogl-pipeline-state.h @@ -59,44 +59,6 @@ COGL_EXPORT void cogl_pipeline_set_color (CoglPipeline *pipeline, const CoglColor *color); -/** - * cogl_pipeline_set_color4ub: - * @pipeline: A #CoglPipeline object - * @red: The red component - * @green: The green component - * @blue: The blue component - * @alpha: The alpha component - * - * Sets the basic color of the pipeline, used when no lighting is enabled. - * - * The default value is (0xff, 0xff, 0xff, 0xff) - */ -COGL_EXPORT void -cogl_pipeline_set_color4ub (CoglPipeline *pipeline, - uint8_t red, - uint8_t green, - uint8_t blue, - uint8_t alpha); - -/** - * cogl_pipeline_set_color4f: - * @pipeline: A #CoglPipeline object - * @red: The red component - * @green: The green component - * @blue: The blue component - * @alpha: The alpha component - * - * Sets the basic color of the pipeline, used when no lighting is enabled. - * - * The default value is (1.0, 1.0, 1.0, 1.0) - */ -COGL_EXPORT void -cogl_pipeline_set_color4f (CoglPipeline *pipeline, - float red, - float green, - float blue, - float alpha); - /** * cogl_pipeline_get_color: * @pipeline: A #CoglPipeline object diff --git a/src/backends/meta-stage-impl.c b/src/backends/meta-stage-impl.c index a2d46ca6d..7aa24439d 100644 --- a/src/backends/meta-stage-impl.c +++ b/src/backends/meta-stage-impl.c @@ -140,6 +140,7 @@ paint_damage_region (ClutterStageWindow *stage_window, CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view); CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); static CoglPipeline *overlay_blue = NULL; + CoglColor blue_color, red_color; MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window); ClutterActor *actor = CLUTTER_ACTOR (stage_impl->wrapper); graphene_matrix_t transform; @@ -156,7 +157,8 @@ paint_damage_region (ClutterStageWindow *stage_window, if (G_UNLIKELY (overlay_blue == NULL)) { overlay_blue = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (overlay_blue, 0x00, 0x00, 0x33, 0x33); + cogl_color_init_from_4f (&blue_color, 0.0, 0.0, 0.2, 0.2); + cogl_pipeline_set_color (overlay_blue, &blue_color); } n_rects = mtk_region_num_rectangles (swap_region); @@ -182,7 +184,8 @@ paint_damage_region (ClutterStageWindow *stage_window, if (G_UNLIKELY (overlay_red == NULL)) { overlay_red = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (overlay_red, 0x33, 0x00, 0x00, 0x33); + cogl_color_init_from_4f (&red_color, 0.2, 0.0, 0.0, 0.2); + cogl_pipeline_set_color (overlay_red, &red_color); } n_rects = mtk_region_num_rectangles (queued_redraw_clip); diff --git a/src/compositor/meta-background-content.c b/src/compositor/meta-background-content.c index cbb3a0a36..5e252959c 100644 --- a/src/compositor/meta-background-content.c +++ b/src/compositor/meta-background-content.c @@ -398,6 +398,7 @@ setup_pipeline (MetaBackgroundContent *self, float color_component; CoglFramebuffer *fb; CoglPipelineFilter min_filter, mag_filter; + CoglColor color; opacity = clutter_actor_get_paint_opacity (actor); if (opacity < 255) @@ -538,11 +539,12 @@ setup_pipeline (MetaBackgroundContent *self, else color_component = opacity / 255.; - cogl_pipeline_set_color4f (self->pipeline, - color_component, - color_component, - color_component, - opacity / 255.); + cogl_color_init_from_4f (&color, + color_component, + color_component, + color_component, + opacity / 255.); + cogl_pipeline_set_color (self->pipeline, &color); fb = clutter_paint_context_get_framebuffer (paint_context); if (meta_actor_painting_untransformed (fb, diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index 43ba461c3..30129237b 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -857,13 +857,16 @@ meta_background_get_texture (MetaBackground *self, { CoglPipeline *pipeline = create_pipeline (PIPELINE_REPLACE); int mipmap_level; + CoglColor color; mipmap_level = get_best_mipmap_level (texture2, texture_width, texture_height); - cogl_pipeline_set_color4f (pipeline, - self->blend_factor, self->blend_factor, self->blend_factor, self->blend_factor); + cogl_color_init_from_4f (&color, + self->blend_factor, self->blend_factor, + self->blend_factor, self->blend_factor); + cogl_pipeline_set_color (pipeline, &color); cogl_pipeline_set_layer_texture (pipeline, 0, texture2); cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (self->style)); cogl_pipeline_set_layer_max_mipmap_level (pipeline, 0, mipmap_level); @@ -886,16 +889,16 @@ meta_background_get_texture (MetaBackground *self, { CoglPipeline *pipeline = create_pipeline (PIPELINE_ADD); int mipmap_level; + CoglColor color; mipmap_level = get_best_mipmap_level (texture1, texture_width, texture_height); - cogl_pipeline_set_color4f (pipeline, - (1 - self->blend_factor), - (1 - self->blend_factor), - (1 - self->blend_factor), - (1 - self->blend_factor)); + cogl_color_init_from_4f (&color, + (1 - self->blend_factor), (1 - self->blend_factor), + (1 - self->blend_factor), (1 - self->blend_factor)); + cogl_pipeline_set_color (pipeline, &color); cogl_pipeline_set_layer_texture (pipeline, 0, texture1); cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (self->style)); cogl_pipeline_set_layer_max_mipmap_level (pipeline, 0, mipmap_level); diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c index 1817ac81b..0ddc08d27 100644 --- a/src/compositor/meta-shadow-factory.c +++ b/src/compositor/meta-shadow-factory.c @@ -202,6 +202,7 @@ meta_shadow_paint (MetaShadow *shadow, MtkRegion *clip, gboolean clip_strictly) { + CoglColor color; float texture_width = cogl_texture_get_width (shadow->texture); float texture_height = cogl_texture_get_height (shadow->texture); int i, j; @@ -214,8 +215,10 @@ meta_shadow_paint (MetaShadow *shadow, if (clip && mtk_region_is_empty (clip)) return; - cogl_pipeline_set_color4ub (shadow->pipeline, - opacity, opacity, opacity, opacity); + cogl_color_init_from_4f (&color, + opacity / 255.0, opacity / 255.0, + opacity / 255.0, opacity / 255.0); + cogl_pipeline_set_color (shadow->pipeline, &color); if (shadow->scale_width) { diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 5924dd22d..0ccb4c1e9 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -488,13 +488,15 @@ static CoglPipeline * get_opaque_overlay_pipeline (CoglContext *ctx) { CoglPipeline *pipeline; + CoglColor color; pipeline = cogl_context_get_named_pipeline (ctx, &opaque_overlay_pipeline_key); if (!pipeline) { pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, 0x00, 0x33, 0x00, 0x33); + cogl_color_init_from_4f (&color, 0.0, 0.2, 0.0, 0.2); + cogl_pipeline_set_color (pipeline, &color); cogl_context_set_named_pipeline (ctx, &opaque_overlay_pipeline_key, @@ -508,13 +510,15 @@ static CoglPipeline * get_blended_overlay_pipeline (CoglContext *ctx) { CoglPipeline *pipeline; + CoglColor color; pipeline = cogl_context_get_named_pipeline (ctx, &blended_overlay_pipeline_key); if (!pipeline) { pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, 0x33, 0x00, 0x33, 0x33); + cogl_color_init_from_4f (&color, 0.2, 0.0, 0.2, 0.2); + cogl_pipeline_set_color (pipeline, &color); cogl_context_set_named_pipeline (ctx, &blended_overlay_pipeline_key, diff --git a/src/tests/clutter/conform/actor-offscreen-redirect.c b/src/tests/clutter/conform/actor-offscreen-redirect.c index 1804b8b23..49b35af56 100644 --- a/src/tests/clutter/conform/actor-offscreen-redirect.c +++ b/src/tests/clutter/conform/actor-offscreen-redirect.c @@ -45,6 +45,7 @@ foo_actor_paint (ClutterActor *actor, ClutterActorBox allocation; CoglPipeline *pipeline; CoglFramebuffer *framebuffer; + CoglColor color; foo_actor->last_paint_opacity = clutter_actor_get_paint_opacity (actor); foo_actor->paint_count++; @@ -53,9 +54,9 @@ foo_actor_paint (ClutterActor *actor, /* Paint a red rectangle with the right opacity */ pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, - 255, 0, 0, - foo_actor->last_paint_opacity); + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, + foo_actor->last_paint_opacity / 255.); + cogl_pipeline_set_color (pipeline, &color); framebuffer = clutter_paint_context_get_framebuffer (paint_context); cogl_framebuffer_draw_rectangle (framebuffer, diff --git a/src/tests/clutter/conform/binding-pool.c b/src/tests/clutter/conform/binding-pool.c index 0a210bb8a..fffb2dcc3 100644 --- a/src/tests/clutter/conform/binding-pool.c +++ b/src/tests/clutter/conform/binding-pool.c @@ -142,10 +142,12 @@ key_group_paint (ClutterActor *actor, ClutterActor *child; CoglPipeline *pipeline; CoglFramebuffer *framebuffer; + CoglColor color; gint i = 0; pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, 255, 255, 0, 224); + cogl_color_init_from_4f (&color, 1.0, 1.0, 0.0, 224. / 255. ); + cogl_pipeline_set_color (pipeline, &color); framebuffer = clutter_paint_context_get_framebuffer (paint_context); diff --git a/src/tests/clutter/interactive/test-binding-pool.c b/src/tests/clutter/interactive/test-binding-pool.c index be8c674de..6360eaa08 100644 --- a/src/tests/clutter/interactive/test-binding-pool.c +++ b/src/tests/clutter/interactive/test-binding-pool.c @@ -173,6 +173,7 @@ key_group_paint (ClutterActor *actor, if (i == self->selected_index) { ClutterActorBox box = { 0, }; + CoglColor color; clutter_actor_get_allocation_box (child, &box); @@ -181,7 +182,8 @@ key_group_paint (ClutterActor *actor, box.x2 += 2; box.y2 += 2; - cogl_pipeline_set_color4ub (pipeline, 255, 255, 0, 224); + cogl_color_init_from_4f (&color, 1.0, 1.0, 0.0, 224.0 / 255.0); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, pipeline, box.x1, box.y1, box.x2, box.y2); diff --git a/src/tests/clutter/interactive/test-cogl-offscreen.c b/src/tests/clutter/interactive/test-cogl-offscreen.c index d6882cbcf..e1049bf33 100644 --- a/src/tests/clutter/interactive/test-cogl-offscreen.c +++ b/src/tests/clutter/interactive/test-cogl-offscreen.c @@ -49,9 +49,11 @@ test_coglbox_paint (ClutterActor *self, CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); gfloat texcoords[4] = { 0, 0, 1, 1 }; CoglPipeline *pipeline; + CoglColor color; pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, 0x66, 0x66, 0xdd, 0xff); + cogl_color_init_from_4f (&color, 0.4, 0.4, 221.0 / 255.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, pipeline, 0, 0, 400, 400); g_object_unref (pipeline); @@ -65,17 +67,23 @@ test_coglbox_paint (ClutterActor *self, g_object_unref (pipeline); pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, 0xff, 0, 0, 0xff); + + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (coglbox->framebuffer, pipeline, 20, 20, 20 + 100, 20 + 100); - cogl_pipeline_set_color4ub (pipeline, 0, 0xff, 0, 0xff); + cogl_color_init_from_4f (&color, 0.0, 1.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (coglbox->framebuffer, pipeline, 80, 80, 80 + 100, 80 + 100); g_object_unref (pipeline); pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, 0x88, 0x88, 0x88, 0x88); + cogl_color_init_from_4f (&color, + 136.0 / 255.0, 136.0 / 255.0, + 136.0 / 255.0, 136.0 / 255.0); + cogl_pipeline_set_color (pipeline, &color); cogl_pipeline_set_layer_texture (pipeline, 0, coglbox->texture_id); cogl_framebuffer_draw_textured_rectangle (framebuffer, pipeline, 100, 100, diff --git a/src/tests/clutter/interactive/test-cogl-tex-tile.c b/src/tests/clutter/interactive/test-cogl-tex-tile.c index 68d998967..cc79d95b3 100644 --- a/src/tests/clutter/interactive/test-cogl-tex-tile.c +++ b/src/tests/clutter/interactive/test-cogl-tex-tile.c @@ -48,6 +48,7 @@ test_coglbox_paint (ClutterActor *self, clutter_paint_context_get_framebuffer (paint_context); CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); CoglPipeline *pipeline; + CoglColor color; gfloat texcoords[4] = { 0.0f, 0.0f, 1.0f, 1.0f }; gfloat angle; gfloat frac; @@ -71,7 +72,8 @@ test_coglbox_paint (ClutterActor *self, cogl_framebuffer_push_matrix (framebuffer); pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_color4ub (pipeline, 0x66, 0x66, 0xdd, 0xff); + cogl_color_init_from_4f (&color, 0.4, 0.4, 221.0 / 255.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, pipeline, 0, 0, 400, 400); g_object_unref (pipeline); diff --git a/src/tests/clutter/micro-bench/test-cogl-perf.c b/src/tests/clutter/micro-bench/test-cogl-perf.c index 9dbe8a0a2..cbe576c41 100644 --- a/src/tests/clutter/micro-bench/test-cogl-perf.c +++ b/src/tests/clutter/micro-bench/test-cogl-perf.c @@ -32,6 +32,7 @@ test_rectangles (TestState *state, int x; int y; CoglPipeline *pipeline; + CoglColor color; /* Should the rectangles be randomly positioned/colored/rotated? * @@ -61,14 +62,16 @@ test_rectangles (TestState *state, { for (x = 0; x < STAGE_WIDTH; x += RECT_WIDTH) { + cogl_color_init_from_4f (&color, + 1, + (1.0f / STAGE_WIDTH) * y, + (1.0f / STAGE_HEIGHT) * x, + 1); + cogl_framebuffer_push_matrix (framebuffer); cogl_framebuffer_translate (framebuffer, x, y, 0); cogl_framebuffer_rotate (framebuffer, 45, 0, 0, 1); - cogl_pipeline_set_color4f (pipeline, - 1, - (1.0f / STAGE_WIDTH) * y, - (1.0f / STAGE_HEIGHT) * x, - 1); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, pipeline, 0, 0, RECT_WIDTH, RECT_HEIGHT); cogl_framebuffer_pop_matrix (framebuffer); @@ -82,11 +85,12 @@ test_rectangles (TestState *state, cogl_framebuffer_push_matrix (framebuffer); cogl_framebuffer_translate (framebuffer, x, y, 0); cogl_framebuffer_rotate (framebuffer, 0, 0, 0, 1); - cogl_pipeline_set_color4f (pipeline, - 1, - (1.0f / STAGE_WIDTH) * x, - (1.0f / STAGE_HEIGHT) * y, - (1.0f / STAGE_WIDTH) * x); + cogl_color_init_from_4f (&color, + 1, + (1.0f / STAGE_WIDTH) * x, + (1.0f / STAGE_HEIGHT) * y, + (1.0f / STAGE_WIDTH) * x); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, pipeline, 0, 0, RECT_WIDTH, RECT_HEIGHT); cogl_framebuffer_pop_matrix (framebuffer); diff --git a/src/tests/cogl/conform/test-backface-culling.c b/src/tests/cogl/conform/test-backface-culling.c index cca954b55..d567b565b 100644 --- a/src/tests/cogl/conform/test-backface-culling.c +++ b/src/tests/cogl/conform/test-backface-culling.c @@ -48,6 +48,7 @@ paint_test_backface_culling (TestState *state, { int draw_num; CoglPipeline *base_pipeline = cogl_pipeline_new (test_ctx); + CoglColor color; cogl_framebuffer_orthographic (framebuffer, 0, 0, @@ -114,7 +115,10 @@ paint_test_backface_culling (TestState *state, /* If the texture is sliced then cogl_polygon doesn't work so we'll just use a solid color instead */ if (cogl_texture_is_sliced (state->texture)) - cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + { + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); + } /* Draw a front-facing polygon */ verts[0].x = x1; verts[0].y = y2; diff --git a/src/tests/cogl/conform/test-blend-strings.c b/src/tests/cogl/conform/test-blend-strings.c index ddc49a454..2f3935cfb 100644 --- a/src/tests/cogl/conform/test-blend-strings.c +++ b/src/tests/cogl/conform/test-blend-strings.c @@ -50,7 +50,7 @@ test_blend_paint (TestState *state, uint8_t Bg = MASK_GREEN (blend_constant); uint8_t Bb = MASK_BLUE (blend_constant); uint8_t Ba = MASK_ALPHA (blend_constant); - CoglColor blend_const_color; + CoglColor blend_const_color, pipeline_color; CoglPipeline *pipeline; gboolean status; @@ -60,7 +60,10 @@ test_blend_paint (TestState *state, /* First write out the destination color without any blending... */ pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, Dr, Dg, Db, Da); + cogl_color_init_from_4f (&pipeline_color, + Dr / 255.0, Dg / 255.0, + Db / 255.0, Da / 255.0); + cogl_pipeline_set_color (pipeline, &pipeline_color); cogl_pipeline_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL); cogl_framebuffer_draw_rectangle (test_fb, pipeline, @@ -75,7 +78,10 @@ test_blend_paint (TestState *state, */ pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, Sr, Sg, Sb, Sa); + cogl_color_init_from_4f (&pipeline_color, + Sr / 255.0, Sg / 255.0, + Sb / 255.0, Sa / 255.0); + cogl_pipeline_set_color (pipeline, &pipeline_color); status = cogl_pipeline_set_blend (pipeline, blend_string, &error); if (!status) @@ -174,7 +180,7 @@ test_tex_combine (TestState *state, uint8_t Cg = MASK_GREEN (combine_constant); uint8_t Cb = MASK_BLUE (combine_constant); uint8_t Ca = MASK_ALPHA (combine_constant); - CoglColor combine_const_color; + CoglColor combine_const_color, pipeline_color; CoglPipeline *pipeline; gboolean status; @@ -188,7 +194,10 @@ test_tex_combine (TestState *state, pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 0x80, 0x80, 0x80, 0x80); + cogl_color_init_from_4f (&pipeline_color, + 128.0 / 255.0, 128.0 / 255.0, + 128.0 / 255.0, 128.0 / 255.0); + cogl_pipeline_set_color (pipeline, &pipeline_color); cogl_pipeline_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL); cogl_pipeline_set_layer_texture (pipeline, 0, tex0); diff --git a/src/tests/cogl/conform/test-custom-attributes.c b/src/tests/cogl/conform/test-custom-attributes.c index 72268086a..028722c58 100644 --- a/src/tests/cogl/conform/test-custom-attributes.c +++ b/src/tests/cogl/conform/test-custom-attributes.c @@ -173,6 +173,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y) CoglPipeline *pipeline, *pipeline2; CoglSnippet *snippet; CoglPrimitive *primitive; + CoglColor color; static const ShortVert short_verts[] = { @@ -184,7 +185,8 @@ test_short_verts (TestState *state, int offset_x, int offset_y) pipeline = cogl_pipeline_copy (state->pipeline); - cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); buffer = cogl_attribute_buffer_new (test_ctx, sizeof (short_verts), short_verts); diff --git a/src/tests/cogl/conform/test-depth-test.c b/src/tests/cogl/conform/test-depth-test.c index de04d1ee7..529e349e4 100644 --- a/src/tests/cogl/conform/test-depth-test.c +++ b/src/tests/cogl/conform/test-depth-test.c @@ -46,6 +46,7 @@ draw_rectangle (TestState *state, uint8_t Ca = MASK_ALPHA (rect_state->color); CoglPipeline *pipeline; CoglDepthState depth_state; + CoglColor color; cogl_depth_state_init (&depth_state); cogl_depth_state_set_test_enabled (&depth_state, rect_state->test_enable); @@ -62,10 +63,13 @@ draw_rectangle (TestState *state, return FALSE; } + cogl_color_init_from_4f (&color, + Cr / 255.0, Cg / 255.0, + Cb / 255.0, Ca / 255.0); + cogl_pipeline_set_color (pipeline, &color); + if (!legacy_mode) { - cogl_pipeline_set_color4ub (pipeline, Cr, Cg, Cb, Ca); - cogl_framebuffer_set_depth_write_enabled (test_fb, rect_state->fb_write_enable); cogl_framebuffer_push_matrix (test_fb); @@ -85,7 +89,6 @@ draw_rectangle (TestState *state, legacy_pipeline = cogl_pipeline_new (test_ctx); cogl_framebuffer_push_matrix (test_fb); - cogl_pipeline_set_color4ub (pipeline, Cr, Cg, Cb, Ca); cogl_framebuffer_translate (test_fb, 0, 0, rect_state->depth); cogl_framebuffer_draw_rectangle (test_fb, pipeline, diff --git a/src/tests/cogl/conform/test-journal.c b/src/tests/cogl/conform/test-journal.c index aa3c15224..ad282e8fb 100644 --- a/src/tests/cogl/conform/test-journal.c +++ b/src/tests/cogl/conform/test-journal.c @@ -11,6 +11,7 @@ test_journal_unref_flush (void) CoglTexture *texture; CoglOffscreen *offscreen; CoglPipeline *pipeline; + CoglColor color; const int width = 1; const int height = 1; const int stride = width * 4; @@ -26,7 +27,8 @@ test_journal_unref_flush (void) g_object_add_weak_pointer (G_OBJECT (offscreen), (gpointer *) &offscreen); pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 0x33, 0x33, 0x33, 0x33); + cogl_color_init_from_4f (&color, 0.2, 0.2, 0.2, 0.2); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (COGL_FRAMEBUFFER (offscreen), pipeline, -1, -1, 1, 1); diff --git a/src/tests/cogl/conform/test-layer-remove.c b/src/tests/cogl/conform/test-layer-remove.c index 2adae55f7..8a41476f7 100644 --- a/src/tests/cogl/conform/test-layer-remove.c +++ b/src/tests/cogl/conform/test-layer-remove.c @@ -11,7 +11,8 @@ create_two_layer_pipeline (void) CoglColor color; /* The pipeline is initially black */ - cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255); + cogl_color_init_from_4f (&color, 0.0, 0.0, 0.0, 255.0); + cogl_pipeline_set_color (pipeline, &color); /* The first layer adds a full red component */ cogl_color_init_from_4ub (&color, 255, 0, 0, 255); diff --git a/src/tests/cogl/conform/test-multitexture.c b/src/tests/cogl/conform/test-multitexture.c index 21355b83f..c0d570c13 100644 --- a/src/tests/cogl/conform/test-multitexture.c +++ b/src/tests/cogl/conform/test-multitexture.c @@ -105,6 +105,7 @@ on_paint (ClutterActor *actor, { CoglTexture *tex0, *tex1; CoglPipeline *pipeline; + CoglColor color; gboolean status; GError *error = NULL; float tex_coords[] = { @@ -118,7 +119,10 @@ on_paint (ClutterActor *actor, pipeline = cogl_pipeline_new (); /* An arbitrary color which should be replaced by the first texture layer */ - cogl_pipeline_set_color4ub (pipeline, 0x80, 0x80, 0x80, 0x80); + cogl_color_init_from_4f (&color, + 128.0 / 255.0, 128.0 / 255.0, + 128.0 / 255.0, 128.0 / 255.0); + cogl_pipeline_set_color (pipeline, &color); cogl_pipekine_set_blend (pipeline, "RGBA = ADD (SRC_COLOR, 0)", NULL); cogl_pipeline_set_layer_texture (pipeline, 0, tex0); diff --git a/src/tests/cogl/conform/test-offscreen.c b/src/tests/cogl/conform/test-offscreen.c index d407069e6..51a8bb36d 100644 --- a/src/tests/cogl/conform/test-offscreen.c +++ b/src/tests/cogl/conform/test-offscreen.c @@ -45,6 +45,7 @@ test_paint (TestState *state) CoglFramebuffer *framebuffer; CoglPipeline *opaque_pipeline; CoglPipeline *texture_pipeline; + CoglColor color; tex = cogl_texture_2d_new_with_size (test_ctx, state->fb_width, @@ -74,19 +75,24 @@ test_paint (TestState *state) opaque_pipeline = cogl_pipeline_new (test_ctx); /* red, top left */ - cogl_pipeline_set_color4ub (opaque_pipeline, 0xff, 0x00, 0x00, 0xff); + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (opaque_pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, opaque_pipeline, -0.5, 0.5, 0, 0); /* green, top right */ - cogl_pipeline_set_color4ub (opaque_pipeline, 0x00, 0xff, 0x00, 0xff); + /* red, top left */ + cogl_color_init_from_4f (&color, 0.0, 1.0, 0.0, 1.0); + cogl_pipeline_set_color (opaque_pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, opaque_pipeline, 0, 0.5, 0.5, 0); /* blue, bottom left */ - cogl_pipeline_set_color4ub (opaque_pipeline, 0x00, 0x00, 0xff, 0xff); + cogl_color_init_from_4f (&color, 0.0, 0.0, 1.0, 1.0); + cogl_pipeline_set_color (opaque_pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, opaque_pipeline, -0.5, 0, 0, -0.5); /* white, bottom right */ - cogl_pipeline_set_color4ub (opaque_pipeline, 0xff, 0xff, 0xff, 0xff); + cogl_color_init_from_4f (&color, 1.0, 1.0, 1.0, 1.0); + cogl_pipeline_set_color (opaque_pipeline, &color); cogl_framebuffer_draw_rectangle (framebuffer, opaque_pipeline, 0, 0, 0.5, -0.5); @@ -124,11 +130,12 @@ test_flush (TestState *state) CoglTexture *tex; CoglOffscreen *offscreen; CoglFramebuffer *framebuffer; - CoglColor clear_color; + CoglColor clear_color, pipeline_color; int i; pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + cogl_color_init_from_4f (&pipeline_color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &pipeline_color); for (i = 0; i < 3; i++) { diff --git a/src/tests/cogl/conform/test-pipeline-shader-state.c b/src/tests/cogl/conform/test-pipeline-shader-state.c index c4dcdc754..04921ffea 100644 --- a/src/tests/cogl/conform/test-pipeline-shader-state.c +++ b/src/tests/cogl/conform/test-pipeline-shader-state.c @@ -13,6 +13,7 @@ test_pipeline_shader_state (void) CoglPipeline *draw_pipeline; CoglTexture *tex; CoglSnippet *snippet; + CoglColor color; float width = cogl_framebuffer_get_width (test_fb); float height = cogl_framebuffer_get_height (test_fb); @@ -35,7 +36,8 @@ test_pipeline_shader_state (void) base_pipeline = cogl_pipeline_new (test_ctx); cogl_pipeline_set_layer_texture (base_pipeline, 1, tex); - cogl_pipeline_set_color4f (base_pipeline, 1, 0, 0, 1); + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (base_pipeline, &color); /* Derive a pipeline from the template, making a change that affects diff --git a/src/tests/cogl/conform/test-point-size-attribute.c b/src/tests/cogl/conform/test-point-size-attribute.c index 2379af08e..063b4ac9c 100644 --- a/src/tests/cogl/conform/test-point-size-attribute.c +++ b/src/tests/cogl/conform/test-point-size-attribute.c @@ -105,6 +105,7 @@ do_test (const char *attribute_name, int fb_height = cogl_framebuffer_get_height (test_fb); CoglPrimitive *primitive; CoglPipeline *pipeline; + CoglColor color; int i; cogl_framebuffer_orthographic (test_fb, @@ -119,7 +120,8 @@ do_test (const char *attribute_name, primitive = create_primitive (attribute_name); pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 0x00, 0xff, 0x00, 0xff); + cogl_color_init_from_4f (&color, 0.0, 1.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); cogl_pipeline_set_per_vertex_point_size (pipeline, TRUE, NULL); if (pipeline_setup_func) pipeline_setup_func (pipeline); diff --git a/src/tests/cogl/conform/test-point-size.c b/src/tests/cogl/conform/test-point-size.c index 69efef232..c734a3dfd 100644 --- a/src/tests/cogl/conform/test-point-size.c +++ b/src/tests/cogl/conform/test-point-size.c @@ -50,9 +50,11 @@ test_point_size (void) { int fb_width = cogl_framebuffer_get_width (test_fb); int fb_height = cogl_framebuffer_get_height (test_fb); + CoglColor color; int point_size; int x_pos; + cogl_color_init_from_4f (&color, 0.0, 1.0, 0.0, 1.0); cogl_framebuffer_orthographic (test_fb, 0, 0, /* x_1, y_1 */ fb_width, /* x_2 */ @@ -79,7 +81,7 @@ test_point_size (void) &point); cogl_pipeline_set_point_size (pipeline, point_size); - cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255); + cogl_pipeline_set_color (pipeline, &color); cogl_primitive_draw (prim, test_fb, pipeline); g_object_unref (prim); diff --git a/src/tests/cogl/conform/test-primitive-and-journal.c b/src/tests/cogl/conform/test-primitive-and-journal.c index 3f045d87b..767a8313e 100644 --- a/src/tests/cogl/conform/test-primitive-and-journal.c +++ b/src/tests/cogl/conform/test-primitive-and-journal.c @@ -55,9 +55,10 @@ create_primitives (CoglPrimitive *primitives[2]) static CoglPipeline * create_pipeline (void) { + CoglColor color; CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); - - cogl_pipeline_set_color4ub (pipeline, 0, 255, 0, 255); + cogl_color_init_from_4f (&color, 0.0, 1.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); return pipeline; } diff --git a/src/tests/cogl/conform/test-primitive.c b/src/tests/cogl/conform/test-primitive.c index 5c7488083..0a0c1beb5 100644 --- a/src/tests/cogl/conform/test-primitive.c +++ b/src/tests/cogl/conform/test-primitive.c @@ -157,6 +157,7 @@ test_paint (TestState *state) { CoglPipeline *pipeline; CoglTexture *tex; + CoglColor color; uint8_t tex_data[6]; int i; @@ -177,11 +178,12 @@ test_paint (TestState *state) 6, /* rowstride */ tex_data); pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, - (PRIM_COLOR >> 24) & 0xff, - (PRIM_COLOR >> 16) & 0xff, - (PRIM_COLOR >> 8) & 0xff, - (PRIM_COLOR >> 0) & 0xff); + cogl_color_init_from_4f (&color, + ((PRIM_COLOR >> 24) & 0xff) / 255.0, + ((PRIM_COLOR >> 16) & 0xff) / 255.0, + ((PRIM_COLOR >> 8) & 0xff) / 255.0, + ((PRIM_COLOR >> 0) & 0xff) / 255.0); + cogl_pipeline_set_color (pipeline, &color); cogl_pipeline_set_layer_texture (pipeline, 0, tex); g_object_unref (tex); diff --git a/src/tests/cogl/conform/test-snippets.c b/src/tests/cogl/conform/test-snippets.c index 8b563fcf3..e6917803a 100644 --- a/src/tests/cogl/conform/test-snippets.c +++ b/src/tests/cogl/conform/test-snippets.c @@ -47,11 +47,13 @@ simple_fragment_snippet (TestState *state) { CoglPipeline *pipeline; CoglSnippet *snippet; + CoglColor color; /* Simple fragment snippet */ pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, /* declarations */ @@ -71,11 +73,13 @@ simple_vertex_snippet (TestState *state) { CoglPipeline *pipeline; CoglSnippet *snippet; + CoglColor color; /* Simple vertex snippet */ pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, NULL, @@ -95,6 +99,7 @@ shared_uniform (TestState *state) { CoglPipeline *pipeline; CoglSnippet *snippet; + CoglColor color; int location; /* Snippets sharing a uniform across the vertex and fragment @@ -104,7 +109,9 @@ shared_uniform (TestState *state) location = cogl_pipeline_get_uniform_location (pipeline, "a_value"); cogl_pipeline_set_uniform_1f (pipeline, location, 0.25f); - cogl_pipeline_set_color4ub (pipeline, 255, 0, 0, 255); + cogl_color_init_from_4f (&color, 1.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); + snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, "uniform float a_value;", @@ -131,13 +138,15 @@ lots_snippets (TestState *state) { CoglPipeline *pipeline; CoglSnippet *snippet; + CoglColor color; int location; int i; /* Lots of snippets on one pipeline */ pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255); + cogl_color_init_from_4f (&color, 0.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); for (i = 0; i < 3; i++) { @@ -175,12 +184,14 @@ shared_variable_pre_post (TestState *state) { CoglPipeline *pipeline; CoglSnippet *snippet; + CoglColor color; /* Test that the pre string can declare variables used by the post string */ pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 255, 255, 255, 255); + cogl_color_init_from_4f (&color, 1.0, 1.0, 1.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, /* declarations */ @@ -489,6 +500,7 @@ test_vertex_transform_hook (TestState *state) { CoglPipeline *pipeline; CoglSnippet *snippet; + CoglColor color; graphene_matrix_t identity_matrix; graphene_matrix_t matrix; float v[16]; @@ -500,7 +512,8 @@ test_vertex_transform_hook (TestState *state) pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 255, 0, 255, 255); + cogl_color_init_from_4f (&color, 1.0, 0.0, 1.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX_TRANSFORM, "uniform mat4 pmat;", @@ -642,6 +655,7 @@ test_snippet_order (TestState *state) { CoglPipeline *pipeline; CoglSnippet *snippet; + CoglColor color; /* Verify that the snippets are executed in the right order. We'll replace the r component of the color in the pre sections of the @@ -652,7 +666,8 @@ test_snippet_order (TestState *state) component from the first */ pipeline = cogl_pipeline_new (test_ctx); - cogl_pipeline_set_color4ub (pipeline, 0, 0, 0, 255); + cogl_color_init_from_4f (&color, 0.0, 0.0, 0.0, 1.0); + cogl_pipeline_set_color (pipeline, &color); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, diff --git a/src/tests/cogl/unit/test-pipeline-glsl.c b/src/tests/cogl/unit/test-pipeline-glsl.c index e510a69e6..1790385fb 100644 --- a/src/tests/cogl/unit/test-pipeline-glsl.c +++ b/src/tests/cogl/unit/test-pipeline-glsl.c @@ -7,6 +7,7 @@ static void test_pipeline_opengl_blend_enable (void) { CoglPipeline *pipeline; + CoglColor color; pipeline = cogl_pipeline_new (test_ctx); @@ -20,7 +21,8 @@ test_pipeline_opengl_blend_enable (void) * disabled */ g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0); - cogl_pipeline_set_color4f (pipeline, 0, 0, 0, 0); + cogl_color_init_from_4f (&color, 0.0, 0.0, 0.0, 0.0); + cogl_pipeline_set_color (pipeline, &color); cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 1, 1); _cogl_framebuffer_flush_journal (test_fb);