From: Ray Strode Date: Sat, 2 May 2009 03:08:09 +0000 (-0400) Subject: [two-step] Pull background color from theme X-Git-Tag: 0.7.0~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d35ec8bd03807445d5edbc5f571057f742e957fd;p=thirdparty%2Fplymouth.git [two-step] Pull background color from theme The OLPC theme looks best when it's white, so we need to be able to specify the background color from the theme. If the theme doesn't specify a background color, we fall back to the old behavior of using the distro default. --- diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c index e1499b2c..bc52873a 100644 --- a/src/plugins/splash/two-step/plugin.c +++ b/src/plugins/splash/two-step/plugin.c @@ -93,6 +93,9 @@ struct _ply_boot_splash_plugin double animation_vertical_alignment; char *animation_dir; + uint32_t background_start_color; + uint32_t background_end_color; + ply_trigger_t *idle_trigger; uint32_t root_is_mounted : 1; @@ -110,6 +113,7 @@ create_plugin (ply_key_file_t *key_file) ply_boot_splash_plugin_t *plugin; char *image_dir, *image_path; char *alignment; + char *color; srand ((int) ply_get_timestamp ()); plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); @@ -142,6 +146,24 @@ create_plugin (ply_key_file_t *key_file) plugin->animation_vertical_alignment = .5; free (alignment); + color = ply_key_file_get_value (key_file, "two-step", "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, "two-step", "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; } @@ -349,9 +371,13 @@ on_erase (ply_boot_splash_plugin_t *plugin, area.width = width; area.height = height; - ply_frame_buffer_fill_with_gradient (plugin->frame_buffer, &area, - PLYMOUTH_BACKGROUND_START_COLOR, - PLYMOUTH_BACKGROUND_END_COLOR); + if (plugin->background_start_color != plugin->background_end_color) + ply_frame_buffer_fill_with_gradient (plugin->frame_buffer, &area, + plugin->background_start_color, + plugin->background_end_color); + else + ply_frame_buffer_fill_with_hex_color (plugin->frame_buffer, &area, + plugin->background_start_color); } static void