]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[two-step] Pull background color from theme
authorRay Strode <rstrode@redhat.com>
Sat, 2 May 2009 03:08:09 +0000 (23:08 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 20 May 2009 21:27:53 +0000 (17:27 -0400)
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.

src/plugins/splash/two-step/plugin.c

index e1499b2cc8e8640b887ca4ec860a8bd2ecdd33dd..bc52873ae8e1515f624b56f5f95037adbdc9ce93 100644 (file)
@@ -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