svn commit: trunk/busybox: include miscutils

vda at busybox.net vda at busybox.net
Fri Mar 28 11:17:35 UTC 2008


Author: vda
Date: 2008-03-28 04:17:35 -0700 (Fri, 28 Mar 2008)
New Revision: 21538

Log:
fbsplash: move to /sbin; small shrink

function                                             old     new   delta
fb_drawprogressbar                                   413     423     +10
fbsplash_main                                       1146    1121     -25



Modified:
   trunk/busybox/include/applets.h
   trunk/busybox/miscutils/fbsplash.c


Changeset:
Modified: trunk/busybox/include/applets.h
===================================================================
--- trunk/busybox/include/applets.h	2008-03-28 10:40:45 UTC (rev 21537)
+++ trunk/busybox/include/applets.h	2008-03-28 11:17:35 UTC (rev 21538)
@@ -149,7 +149,7 @@
 USE_FAKEIDENTD(APPLET(fakeidentd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
 USE_FALSE(APPLET_NOFORK(false, false, _BB_DIR_BIN, _BB_SUID_NEVER, false))
 USE_FBSET(APPLET(fbset, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
-USE_FBSPLASH(APPLET(fbsplash, _BB_DIR_BIN, _BB_SUID_NEVER))
+USE_FBSPLASH(APPLET(fbsplash, _BB_DIR_SBIN, _BB_SUID_NEVER))
 USE_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, _BB_DIR_BIN, _BB_SUID_NEVER, fdflush))
 USE_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
 USE_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))

Modified: trunk/busybox/miscutils/fbsplash.c
===================================================================
--- trunk/busybox/miscutils/fbsplash.c	2008-03-28 10:40:45 UTC (rev 21537)
+++ trunk/busybox/miscutils/fbsplash.c	2008-03-28 11:17:35 UTC (rev 21538)
@@ -95,16 +95,15 @@
 
 /**
  *	Draw hollow rectangle on framebuffer
- * \param nx1pos,ny1pos upper left position
- * \param nx2pos,ny2pos down right position
- * \param nred,ngreen,nblue rgb color
  */
-static void fb_drawrectangle(int nx1pos, int ny1pos, int nx2pos, int ny2pos,
-	unsigned char nred, unsigned char ngreen, unsigned char nblue)
+static void fb_drawrectangle(void)
 {
 	int cnt;
 	DATA thispix;
 	DATA *ptr1, *ptr2;
+	unsigned char nred = G.nbar_colr/2;
+	unsigned char ngreen =  G.nbar_colg/2;
+	unsigned char nblue = G.nbar_colb/2;
 
 	nred   >>= 3;  // 5-bit red
 	ngreen >>= 2;  // 6-bit green
@@ -112,18 +111,18 @@
 	thispix = nblue + (ngreen << 5) + (nred << (5+6));
 
 	// horizontal lines
-	ptr1 = (DATA*)(G.addr + (ny1pos * G.scr_var.xres + nx1pos) * BYTES_PER_PIXEL);
-	ptr2 = (DATA*)(G.addr + (ny2pos * G.scr_var.xres + nx1pos) * BYTES_PER_PIXEL);
-	cnt = nx2pos - nx1pos;
+	ptr1 = (DATA*)(G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx) * BYTES_PER_PIXEL);
+	ptr2 = (DATA*)(G.addr + ((G.nbar_posy + G.nbar_height - 1) * G.scr_var.xres + G.nbar_posx) * BYTES_PER_PIXEL);
+	cnt = G.nbar_width - 1;
 	do {
 		*ptr1++ = thispix;
 		*ptr2++ = thispix;
 	} while (--cnt >= 0);
 
 	// vertical lines
-	ptr1 = (DATA*)(G.addr + (ny1pos * G.scr_var.xres + nx1pos) * BYTES_PER_PIXEL);
-	ptr2 = (DATA*)(G.addr + (ny1pos * G.scr_var.xres + nx2pos) * BYTES_PER_PIXEL);
-	cnt = ny2pos - ny1pos;
+	ptr1 = (DATA*)(G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx) * BYTES_PER_PIXEL);
+	ptr2 = (DATA*)(G.addr + (G.nbar_posy * G.scr_var.xres + G.nbar_posx + G.nbar_width - 1) * BYTES_PER_PIXEL);
+	cnt = G.nbar_posy + G.nbar_height - 1 - G.nbar_posy;
 	do {
 		*ptr1 = thispix; ptr1 += G.scr_var.xres;
 		*ptr2 = thispix; ptr2 += G.scr_var.xres;
@@ -179,10 +178,7 @@
 	if ((height | width) < 0)
 		return;
 	// NB: "width" of 1 actually makes rect with width of 2!
-	fb_drawrectangle(
-			left_x, top_y,
-					left_x + width, top_y + height,
-			G.nbar_colr/2, G.nbar_colg/2, G.nbar_colb/2);
+	fb_drawrectangle();
 
 	// inner "empty" rectangle
 	left_x++;
@@ -279,9 +275,10 @@
 
 
 /**
- * Parse configuration file
+ *	Parse configuration file
+ * \param *cfg_filename name of the configuration file
  */
-static void init(const char *ini_filename)
+static void init(const char *cfg_filename)
 {
 	static const char const param_names[] ALIGN1 =
 		"BAR_LEFT\0" "BAR_TOP\0"
@@ -295,7 +292,7 @@
 	FILE *inifile;
 	char *buf;
 
-	inifile = xfopen_stdin(ini_filename);
+	inifile = xfopen_stdin(cfg_filename);
 
 	while ((buf = xmalloc_fgetline(inifile)) != NULL) {
 		char *value_str;
@@ -361,7 +358,7 @@
 int fbsplash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int fbsplash_main(int argc ATTRIBUTE_UNUSED, char **argv)
 {
-	const char *fb_device, *ini_filename, *fifo_filename;
+	const char *fb_device, *cfg_filename, *fifo_filename;
 	FILE *fp = fp; // for compiler
 	bool bCursorOff;
 
@@ -369,22 +366,19 @@
 
 	// parse command line options
 	fb_device = "/dev/fb0";
-	ini_filename = NULL;
+	cfg_filename = NULL;
 	fifo_filename = NULL;
 	bCursorOff = 1 & getopt32(argv, "cs:d:i:f:",
-			&G.image_filename, &fb_device, &ini_filename, &fifo_filename);
+			&G.image_filename, &fb_device, &cfg_filename, &fifo_filename);
 
 	// parse configuration file
-	if (ini_filename)
-		init(ini_filename);
+	if (cfg_filename)
+		init(cfg_filename);
 
 	// We must have -s IMG
 	if (!G.image_filename)
 		bb_show_usage();
 
-	if (fifo_filename)
-		fp = xfopen_stdin(fifo_filename);
-
 	fb_open(fb_device);
 
 	if (fifo_filename && bCursorOff) {
@@ -394,7 +388,12 @@
 
 	fb_drawimage();
 
-	if (fifo_filename) while (1) {
+	if (!fifo_filename)
+		return EXIT_SUCCESS;
+
+	fp = xfopen_stdin(fifo_filename);
+
+	while (1) {
 		struct stat statbuf;
 		unsigned num;
 		char *num_buf;




More information about the busybox-cvs mailing list