socsvn commit: r271352 - soc2014/seiya/bootsplash/sys/dev/fb

seiya at FreeBSD.org seiya at FreeBSD.org
Fri Jul 25 00:21:43 UTC 2014


Author: seiya
Date: Fri Jul 25 00:21:42 2014
New Revision: 271352
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=271352

Log:
  support --repeat-animation

Modified:
  soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c

Modified: soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c
==============================================================================
--- soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c	Fri Jul 25 00:07:11 2014	(r271351)
+++ soc2014/seiya/bootsplash/sys/dev/fb/bsplash.c	Fri Jul 25 00:21:42 2014	(r271352)
@@ -52,12 +52,13 @@
 
 static video_adapter_t *adp = NULL;
 static BMP_INFO	bmp_info;
-static int	background_enabled	= 1; // 1:enabled, 0:disabled
+static int	background_enabled	= 1;	// 1:enabled, 0:disabled
 static int	background_y_origin;
-static int	animation_enabled	= 1;  // 1:enabled, 0:disabled
+static int	animation_enabled	= 1;	// 1:enabled, 0:disabled
+static int	repeat_animation;		// 1:repeat, 0:don't repeat
 static int	animation_y_origin, animation_y, animation_x;
 static int	animation_width, animation_height;
-static int	progress_bar_enabled	= 1;  // 1:enabled, 0:disabled
+static int	progress_bar_enabled	= 1;	// 1:enabled, 0:disabled
 static int	progress_bar_y_origin, progress_bar_y, progress_bar_x;
 static int	progress_bar_width, progress_bar_height;
 
@@ -92,6 +93,19 @@
 	}
 	freeenv(s);
 
+        // load "bsplash_repeat_animation"
+	if ((s = getenv("bsplash_repeat_animation")) == NULL) {
+		if (bootverbose)
+			printf("bsplash: cannot load \"bsplash_repeat_animation\"\n");
+		animation_enabled = 0;
+	} else {
+		if(strcmp(s, "YES") == 0)
+			repeat_animation = 1;
+		else
+			repeat_animation = 0;
+	}
+	freeenv(s);
+
         // load "bsplash_animation_y_origin"
 	if ((s = getenv("bsplash_animation_y_origin")) == NULL) {
 		if (bootverbose)
@@ -263,16 +277,26 @@
 	static int	iy;
 	char		*s;
 	int		progress = 0;
+	int		stop_animation = 0;
 
 	iy = animation_y_origin;
 	for (;;){
 		// update animation
-		if (draw_bmp(iy, animation_y, animation_x, animation_width, animation_height) == 0){
-			iy += animation_height;
-		}else{
-			iy = animation_y_origin;
-			if (draw_bmp(iy, animation_y, animation_x, animation_width, animation_height) == 0)
+		if(!stop_animation){
+			if (draw_bmp(iy, animation_y, animation_x, animation_width,
+			    animation_height) == 0){
 				iy += animation_height;
+			} else {
+				if (!repeat_animation){
+					stop_animation = 1;
+				} else {
+					iy = animation_y_origin;
+					// try again
+					if (draw_bmp(iy, animation_y, animation_x, animation_width,
+					    animation_height) == 0)
+						iy += animation_height;
+				}
+			}
 		}
 
 		// get the progress of boot


More information about the svn-soc-all mailing list