throbgress: make colors configurable

This commit makes the background start and
background end colors configurable in throbgress.
calculate-0.9.5
Leho Kraav 13 years ago committed by Ray Strode
parent b7701d690a
commit 5439ef520d

@ -94,6 +94,9 @@ struct _ply_boot_splash_plugin
char *image_dir;
ply_boot_splash_display_type_t state;
uint32_t background_start_color;
uint32_t background_end_color;
ply_trigger_t *idle_trigger;
uint32_t root_is_mounted : 1;
@ -373,6 +376,7 @@ create_plugin (ply_key_file_t *key_file)
{
ply_boot_splash_plugin_t *plugin;
char *image_dir, *image_path;
char *color;
srand ((int) ply_get_timestamp ());
plugin = calloc (1, sizeof (ply_boot_splash_plugin_t));
@ -391,6 +395,24 @@ create_plugin (ply_key_file_t *key_file)
plugin->image_dir = image_dir;
plugin->views = ply_list_new ();
color = ply_key_file_get_value (key_file, "throbgress", "BackgroundStartColor");
if (color != NULL)
plugin->background_start_color = strtol (color, NULL, 0);
else
plugin->background_start_color = PLYMOUTH_BACKGROUND_START_COLOR;
free (color);
color = ply_key_file_get_value (key_file, "throbgress", "BackgroundEndColor");
if (color != NULL)
plugin->background_end_color = strtol (color, NULL, 0);
else
plugin->background_end_color = PLYMOUTH_BACKGROUND_END_COLOR;
free (color);
return plugin;
}
@ -427,14 +449,20 @@ draw_background (view_t *view,
{
ply_rectangle_t area;
plugin = view->plugin;
area.x = x;
area.y = y;
area.width = width;
area.height = height;
ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area,
PLYMOUTH_BACKGROUND_START_COLOR,
PLYMOUTH_BACKGROUND_END_COLOR);
if (plugin->background_start_color != plugin->background_end_color)
ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area,
plugin->background_start_color,
plugin->background_end_color);
else
ply_pixel_buffer_fill_with_hex_color (pixel_buffer, &area,
plugin->background_start_color);
}
static void

Loading…
Cancel
Save