]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
throbgress: make colors configurable
authorLeho Kraav <leho@kraav.com>
Thu, 18 Aug 2011 15:06:17 +0000 (18:06 +0300)
committerRay Strode <rstrode@redhat.com>
Thu, 18 Aug 2011 15:23:44 +0000 (11:23 -0400)
This commit makes the background start and
background end colors configurable in throbgress.

src/plugins/splash/throbgress/plugin.c

index 895541cb05900ca53ff2b0bdd0b02ed1ae60187c..3737a9fa21f45de7bcd94bcb2dde45b307c770e7 100644 (file)
@@ -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