mirror of
https://github.com/brl/mutter.git
synced 2025-01-12 20:52:37 +00:00
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3086>
This commit is contained in:
parent
7bd4e18231
commit
c0fdf0a470
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user