walters / rpms / plymouth

Forked from rpms/plymouth 6 years ago
Clone
8542591
diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c
8542591
--- plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx	2008-06-30 17:51:25.000000000 -0400
8542591
+++ plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c	2008-08-12 12:44:42.000000000 -0400
8542591
@@ -50,7 +50,7 @@
8542591
 #include <linux/kd.h>
8542591
 
8542591
 #ifndef FRAMES_PER_SECOND
8542591
-#define FRAMES_PER_SECOND 10
8542591
+#define FRAMES_PER_SECOND 5
8542591
 #endif
8542591
 
8542591
 #define NUMBER_OF_INDICATOR_COLUMNS 6
8542591
@@ -75,13 +75,11 @@ ply_text_pulser_new (void)
8542591
 
8542591
   pulser = calloc (1, sizeof (ply_text_pulser_t));
8542591
 
8542591
-  pulser->number_of_rows = 0;
8542591
-  pulser->number_of_columns = 0;
8542591
   pulser->row = 0;
8542591
   pulser->column = 0;
8542591
   pulser->spinner_position = 0;
8542591
-  pulser->number_of_columns = 40;
8542591
-  pulser->number_of_rows = 1;
8542591
+  pulser->number_of_columns = 0;
8542591
+  pulser->number_of_rows = 0;
8542591
 
8542591
   return pulser;
8542591
 }
8542591
@@ -95,42 +93,71 @@ ply_text_pulser_free (ply_text_pulser_t 
8542591
   free (pulser);
8542591
 }
8542591
 
8542591
-static void
8542591
-draw_trough (ply_text_pulser_t *pulser,
8542591
-             int                column,
8542591
-             int                row)
8542591
-{
8542591
-  char *bytes;
8542591
-
8542591
-  ply_window_set_text_cursor_position (pulser->window,
8542591
-                                       column,
8542591
-                                       row);
8542591
-  ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BROWN);
8542591
-  bytes = malloc (pulser->number_of_columns);
8542591
-  memset (bytes, ' ', pulser->number_of_columns);
8542591
-  write (STDOUT_FILENO, bytes, pulser->number_of_columns);
8542591
-  free (bytes);
8542591
+/* Hi Will! */
8542591
+static double
8542591
+woodsify(double time, double estimate)
8542591
+{
8542591
+    return 1.0 - pow(2.0, -pow(time, 1.45) / estimate);
8542591
 }
8542591
 
8542591
+#define STARTUP_TIME 20.0
8542591
+#define OS_STRING " Fedora 10"
8542591
+
8542591
 static void
8542591
 animate_at_time (ply_text_pulser_t *pulser,
8542591
                  double             time)
8542591
 {
8542591
-  ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
8542591
+    int i, width = pulser->number_of_columns - 2 - strlen(OS_STRING);
8542591
+    double brown_fraction, blue_fraction, white_fraction;
8542591
+
8542591
+    ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
8542591
+    ply_window_set_text_cursor_position(pulser->window,
8542591
+					pulser->column,
8542591
+					pulser->row);
8542591
+
8542591
+    brown_fraction = woodsify(time, STARTUP_TIME);
8542591
+    blue_fraction  = woodsify(time, STARTUP_TIME / brown_fraction);
8542591
+    white_fraction = woodsify(time, STARTUP_TIME / blue_fraction);
8542591
+
8542591
+    for (i = 0; i < width; i += 1) {
8542591
+	double f = (double)i / (double)width;
8542591
+	if (f < white_fraction)
8542591
+	    ply_window_set_background_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_WHITE);
8542591
+	else if (f < blue_fraction)
8542591
+	    ply_window_set_background_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BLUE);
8542591
+	else if (f < brown_fraction)
8542591
+	    ply_window_set_background_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BROWN);
8542591
+	else break;
8542591
 
8542591
-  draw_trough (pulser, pulser->column, pulser->row);
8542591
+	write (STDOUT_FILENO, " ", strlen (" "));
8542591
+    }
8542591
 
8542591
-  ply_window_set_text_cursor_position (pulser->window,
8542591
-                                       pulser->column + pulser->spinner_position,
8542591
-                                       pulser->row);
8542591
-  pulser->spinner_position = (pulser->number_of_columns - strlen ("      ") + 1)  * (.5 * sin (time) + .5);
8542591
-  ply_window_set_text_cursor_position (pulser->window,
8542591
-                                       pulser->column + pulser->spinner_position,
8542591
-                                       pulser->row);
8542591
-
8542591
-  ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_GREEN);
8542591
-  write (STDOUT_FILENO, "      ", strlen ("      "));
8542591
-  ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_DEFAULT);
8542591
+    ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BLACK);
8542591
+
8542591
+    if (brown_fraction > 0.5) {
8542591
+	if (white_fraction > 0.875)
8542591
+	    ply_window_set_foreground_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_WHITE);
8542591
+	else if (blue_fraction > 0.66)
8542591
+	    ply_window_set_foreground_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BLUE);
8542591
+	else
8542591
+	    ply_window_set_foreground_color (pulser->window,
8542591
+					     PLY_WINDOW_COLOR_BROWN);
8542591
+
8542591
+	ply_window_set_text_cursor_position(pulser->window,
8542591
+					    pulser->column + width,
8542591
+					    pulser->row);
8542591
+
8542591
+
8542591
+	write (STDOUT_FILENO, OS_STRING, strlen(OS_STRING));
8542591
+	
8542591
+	ply_window_set_foreground_color (pulser->window,
8542591
+					 PLY_WINDOW_COLOR_DEFAULT);
8542591
+    }
8542591
 }
8542591
 
8542591
 static void
8542591
@@ -161,9 +188,7 @@ on_timeout (ply_text_pulser_t *pulser)
8542591
 bool
8542591
 ply_text_pulser_start (ply_text_pulser_t  *pulser,
8542591
                        ply_event_loop_t   *loop,
8542591
-                       ply_window_t       *window,
8542591
-                       int                 column,
8542591
-                       int                 row)
8542591
+                       ply_window_t       *window)
8542591
 {
8542591
   assert (pulser != NULL);
8542591
   assert (pulser->loop == NULL);
8542591
@@ -171,8 +196,10 @@ ply_text_pulser_start (ply_text_pulser_t
8542591
   pulser->loop = loop;
8542591
   pulser->window = window;
8542591
 
8542591
-  pulser->row = row;
8542591
-  pulser->column = column;
8542591
+  pulser->number_of_rows = ply_window_get_number_of_text_rows(window);
8542591
+  pulser->row = pulser->number_of_rows - 1;
8542591
+  pulser->number_of_columns = ply_window_get_number_of_text_columns(window);
8542591
+  pulser->column = 2;
8542591
 
8542591
   pulser->start_time = ply_get_timestamp ();
8542591
 
8542591
diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h.jx plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h
8542591
--- plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h.jx	2008-06-21 23:48:59.000000000 -0400
8542591
+++ plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h	2008-08-12 12:36:51.000000000 -0400
8542591
@@ -38,9 +38,7 @@ void ply_text_pulser_free (ply_text_puls
8542591
 bool ply_text_pulser_load (ply_text_pulser_t *pulser);
8542591
 bool ply_text_pulser_start (ply_text_pulser_t  *pulser,
8542591
                             ply_event_loop_t   *loop,
8542591
-                            ply_window_t       *window,
8542591
-                            int                 column,
8542591
-                            int                 row);
8542591
+                            ply_window_t       *window);
8542591
 void ply_text_pulser_stop (ply_text_pulser_t *pulser);
8542591
 
8542591
 int ply_text_pulser_get_number_of_rows (ply_text_pulser_t *pulser);
8542591
diff -up plymouth-0.5.0/src/splash-plugins/text/plugin.c.jx plymouth-0.5.0/src/splash-plugins/text/plugin.c
8542591
--- plymouth-0.5.0/src/splash-plugins/text/plugin.c.jx	2008-07-29 15:15:51.000000000 -0400
8542591
+++ plymouth-0.5.0/src/splash-plugins/text/plugin.c	2008-08-12 12:36:51.000000000 -0400
8542591
@@ -105,28 +105,33 @@ start_animation (ply_boot_splash_plugin_
8542591
   assert (plugin->loop != NULL);
8542591
 
8542591
   ply_window_set_color_hex_value (plugin->window,
8542591
+                                  PLY_WINDOW_COLOR_BLACK,
8542591
+                                  0x000000);
8542591
+  ply_window_set_color_hex_value (plugin->window,
8542591
+                                  PLY_WINDOW_COLOR_WHITE,
8542591
+                                  0xffffff);
8542591
+  ply_window_set_color_hex_value (plugin->window,
8542591
+                                  PLY_WINDOW_COLOR_BLUE,
8542591
+                                  0x0073B3);
8542591
+  ply_window_set_color_hex_value (plugin->window,
8542591
                                   PLY_WINDOW_COLOR_BROWN,
8542591
-                                  PLYMOUTH_BACKGROUND_END_COLOR);
8542591
+                                  0x00457E);
8542591
+#if 0
8542591
   ply_window_set_color_hex_value (plugin->window,
8542591
                                   PLY_WINDOW_COLOR_BLUE,
8542591
                                   PLYMOUTH_BACKGROUND_START_COLOR);
8542591
   ply_window_set_color_hex_value (plugin->window,
8542591
                                   PLY_WINDOW_COLOR_GREEN,
8542591
                                   PLYMOUTH_BACKGROUND_COLOR);
8542591
+#endif
8542591
 
8542591
-  ply_window_set_background_color (plugin->window, PLY_WINDOW_COLOR_BLUE);
8542591
+  ply_window_set_background_color (plugin->window, PLY_WINDOW_COLOR_BLACK);
8542591
   ply_window_clear_screen (plugin->window);
8542591
   ply_window_hide_text_cursor (plugin->window);
8542591
 
8542591
-  window_width = ply_window_get_number_of_text_columns (plugin->window);
8542591
-  window_height = ply_window_get_number_of_text_rows (plugin->window);
8542591
-  width = ply_text_pulser_get_number_of_columns (plugin->pulser);
8542591
-  height = ply_text_pulser_get_number_of_rows (plugin->pulser);
8542591
   ply_text_pulser_start (plugin->pulser,
8542591
                          plugin->loop,
8542591
-                         plugin->window,
8542591
-                         window_width / 2.0 - width / 2.0,
8542591
-                         window_height / 2.0 - height / 2.0);
8542591
+                         plugin->window);
8542591
 }
8542591
 
8542591
 static void