From c0fdf0a47070e8013b4073ca0a7325eb57aea45c Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 22 Jun 2023 12:56:38 +0200 Subject: [PATCH] clutter: Drop set_source_color helper The helper doesn't do anything that makes it worth to be exposed as public API. End-users, such as GNOME Shell could have an in-tree helper if they end up using it that much. Part-of: --- clutter/clutter/clutter-cairo.c | 36 ------------------- clutter/clutter/clutter-cairo.h | 3 -- .../clutter/interactive/test-cairo-clock.c | 15 ++++++-- 3 files changed, 12 insertions(+), 42 deletions(-) diff --git a/clutter/clutter/clutter-cairo.c b/clutter/clutter/clutter-cairo.c index 0293b3600..cb8d23258 100644 --- a/clutter/clutter/clutter-cairo.c +++ b/clutter/clutter/clutter-cairo.c @@ -32,42 +32,6 @@ #include "clutter/clutter-cairo.h" #include "clutter/clutter-color.h" -/** - * clutter_cairo_set_source_color: - * @cr: a Cairo context - * @color: a #ClutterColor - * - * Utility function for setting the source color of @cr using - * a #ClutterColor. This function is the equivalent of: - * - * ```c - * cairo_set_source_rgba (cr, - * color->red / 255.0, - * color->green / 255.0, - * color->blue / 255.0, - * color->alpha / 255.0); - * ``` - */ -void -clutter_cairo_set_source_color (cairo_t *cr, - const ClutterColor *color) -{ - g_return_if_fail (cr != NULL); - g_return_if_fail (color != NULL); - - if (color->alpha == 0xff) - cairo_set_source_rgb (cr, - color->red / 255.0, - color->green / 255.0, - color->blue / 255.0); - else - cairo_set_source_rgba (cr, - color->red / 255.0, - color->green / 255.0, - color->blue / 255.0, - color->alpha / 255.0); -} - /** * clutter_cairo_clear: * @cr: a Cairo context diff --git a/clutter/clutter/clutter-cairo.h b/clutter/clutter/clutter-cairo.h index 2fecd75a4..9ba2b19ea 100644 --- a/clutter/clutter/clutter-cairo.h +++ b/clutter/clutter/clutter-cairo.h @@ -49,8 +49,5 @@ G_BEGIN_DECLS CLUTTER_EXPORT void clutter_cairo_clear (cairo_t *cr); -CLUTTER_EXPORT -void clutter_cairo_set_source_color (cairo_t *cr, - const ClutterColor *color); G_END_DECLS diff --git a/src/tests/clutter/interactive/test-cairo-clock.c b/src/tests/clutter/interactive/test-cairo-clock.c index 9f0d210bf..b871e88da 100644 --- a/src/tests/clutter/interactive/test-cairo-clock.c +++ b/src/tests/clutter/interactive/test-cairo-clock.c @@ -42,19 +42,28 @@ draw_clock (ClutterCanvas *canvas, cairo_set_line_width (cr, 0.1); /* the black rail that holds the seconds indicator */ - clutter_cairo_set_source_color (cr, CLUTTER_COLOR_Black); + cairo_set_source_rgb (cr, + CLUTTER_COLOR_Black->red / 255.0, + CLUTTER_COLOR_Black->green / 255.0, + CLUTTER_COLOR_Black->blue / 255.0); cairo_translate (cr, 0.5, 0.5); cairo_arc (cr, 0, 0, 0.4, 0, G_PI * 2); cairo_stroke (cr); /* the seconds indicator */ - clutter_cairo_set_source_color (cr, CLUTTER_COLOR_White); + cairo_set_source_rgb (cr, + CLUTTER_COLOR_White->red / 255.0, + CLUTTER_COLOR_White->green / 255.0, + CLUTTER_COLOR_White->blue / 255.0); cairo_move_to (cr, 0, 0); cairo_arc (cr, sinf (seconds) * 0.4, - cosf (seconds) * 0.4, 0.05, 0, G_PI * 2); cairo_fill (cr); /* the minutes hand */ - clutter_cairo_set_source_color (cr, CLUTTER_COLOR_DarkChameleon); + cairo_set_source_rgb (cr, + CLUTTER_COLOR_DarkChameleon->red / 255.0, + CLUTTER_COLOR_DarkChameleon->green / 255.0, + CLUTTER_COLOR_DarkChameleon->blue / 255.0); cairo_move_to (cr, 0, 0); cairo_line_to (cr, sinf (minutes) * 0.4, -cosf (minutes) * 0.4); cairo_stroke (cr);