Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Aug 2012 00:21:23 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 215204 for review
Message-ID:  <201208010021.q710LNVP068852@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@215204?ac=10

Change 215204 by brooks@brooks_ecr_current on 2012/08/01 00:21:21

	Add a show sandboxes toggle that lets you see what areas are
	derived from data generated in a sandbox.

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#17 edit
.. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/images/browser.png#5 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#17 (text+ko) ====

@@ -64,11 +64,17 @@
 #define	vred(v)		fb_colour((v), 0, 0)
 #define	vgreen(v)	fb_colour(0, (v), 0)
 #define	vblue(v)	fb_colour(0, 0, (v))
+#define	vyellow(v)	fb_colour((v), (v), 0)
+#define	vcyan(v)	fb_colour(0, (v), (v))
+#define	vmagenta(v)	fb_colour((v), 0, (v))
 #define	black		vwhite(0)
 #define	white		vwhite(0xFF)
 #define	red		vred(0xFF)
 #define	green		vgreen(0xFF)
 #define	blue		vblue(0xFF)
+#define yellow		vyellow(0xFF)
+#define cyan		vcyan(0xFF)
+#define magenta		vmagenta(0xFF)
 
 /*
  * Each file is displayed in a 266x40 box:
@@ -119,6 +125,9 @@
 #define	SB_MINROW		(fb_height - 38)
 #define	SB_MAXROW		(fb_height - 1)
 
+#define SB_SHOW_MINCOL		606
+#define SB_SHOW_MAXCOL		793
+
 /* Start offsets for browser columns */
 const int	colstart[] = {0, 267, 534};
 
@@ -179,6 +188,15 @@
 	{ 0, 0, 0, 0 }
 };
 
+static int sbshow = 0;
+
+/*
+ * baseimage is the black and white background image with any disabled
+ * protection modes grayed out.  After init_bgimage() runs it will not
+ * be modified.  bgimage starts equal to baseimage and is updated as
+ * the sandbox mode changes and showing sandboxes is toggled.
+ */
+static u_int32_t	*baseimage;
 static u_int32_t	*bgimage;
 static u_int32_t	*icons;
 static magic_t		 magic;
@@ -433,7 +451,10 @@
 	bgimage = malloc(sizeof(u_int32_t) * fb_height * fb_width);
 	if (bgimage == NULL)
 		err(1, "malloc");
-	read_png_file(BASEIMG, bgimage, fb_width, fb_height);
+	baseimage = malloc(sizeof(u_int32_t) * fb_height * fb_width);
+	if (baseimage == NULL)
+		err(1, "malloc");
+	read_png_file(BASEIMG, baseimage, fb_width, fb_height);
 
 	for (sb = 0; sbdata[sb].sbtype != 0; sb++) {
 		if (sbdata[sb].enabled)
@@ -441,10 +462,13 @@
 		for (j = SB_MINROW; j < SB_MAXROW; j++) {
 			for (i = sbdata[sb].bcol; i <= sbdata[sb].ecol; i++) {
 				pixel = (j * fb_width) + i;
-				bgimage[pixel] = vwhite(((bgimage[pixel] >> 24) & 0xFF) / 2);
+				baseimage[pixel] = vwhite(
+				    ((baseimage[pixel] >> 24) & 0xFF) / 2);
 			}
 		}
 	}
+
+	memcpy(bgimage, baseimage, sizeof(u_int32_t) * fb_height * fb_width);
 }
 
 static void
@@ -464,22 +488,33 @@
 	for (j = SB_MINROW; j < SB_MAXROW; j++) {
 		for (i = SB_MINCOL; i <= SB_MAXCOL; i++) {
 			pixel = (j * fb_width) + i;
-			if (bgimage[pixel] != black) {
-				/* XXX: Assuming we're either blue or white */
-				value = (bgimage[pixel] >> 24) & 0xFF;
-				if (value == 0) {
-					printf("unexpected zero value, pixel %08x\n",
-					    bgimage[pixel]);
-					value = 0xff;
-				}
+			if (baseimage[pixel] != black) {
+				value = (baseimage[pixel] >> 24) & 0xFF;
 				bgimage[pixel] = (i >= bcol && i <= ecol) ?
 				    vblue(value) : vwhite(value);
 			}
 		}
+		for (i = SB_SHOW_MINCOL; i <= SB_SHOW_MAXCOL; i++) {
+			pixel = (j * fb_width) + i;
+			if (bgimage[pixel] != black) {
+				value = (baseimage[pixel] >> 16) & 0xFF;
+				bgimage[pixel] = (sbtype == SB_NONE) ?
+				    vwhite(value / 2) : (sbshow ?
+				    vyellow(value) : vwhite(value));
+			}
+		}
 	}
 	fb_post(bgimage);
 }
 
+static void
+toggle_sbshow(void)
+{
+
+	sbshow = (sbshow + 1) % 2;
+	update_sandbox(sbtype);
+}
+
 static const char *
 get_desc(int dfd, struct dirent *entry)
 {
@@ -555,6 +590,10 @@
 	fb_post_region(textbuf, colstart[(s/NROW)] + TEXT_OFFSET,
 	    FROW + (RHEIGHT * (s % NROW)) + BORDER, TEXTSPACE,
 	    CHAR_HEIGHT);
+	if (sbshow && sbtype != SB_NONE)
+		fb_fill_region(yellow, colstart[(s/NROW)] + BORDER - 1,
+		    FROW + (RHEIGHT * (s % NROW)) + BORDER - 1,
+		    ICON_WH + 2, ICON_WH + 2);
 	fb_post_region(icon, colstart[(s/NROW)] + BORDER,
 	    FROW + (RHEIGHT * (s % NROW)) + BORDER, ICON_WH, ICON_WH);
 }
@@ -595,7 +634,8 @@
 			} else {
 				if (ts->ts_x1 >= SB_MINCOL &&
 				    ts->ts_x1 <= SB_MAXCOL) {
-					for (i =0 ; ts->ts_x1 < sbdata[i].bcol ||
+					for (i = 0;
+					    ts->ts_x1 < sbdata[i].bcol ||
 					    ts->ts_x1 > sbdata[i].ecol; i++)
 						/* do nothing */;
 					assert(sbdata[i].sbtype != 0);
@@ -605,6 +645,11 @@
 					update_sandbox(sbdata[i].sbtype);
 					return (ACT_REFRESH);
 				}
+				if (ts->ts_x1 >= SB_SHOW_MINCOL &&
+				    ts->ts_x1 <= SB_SHOW_MAXCOL) {
+					toggle_sbshow();
+					return (ACT_REFRESH);
+				}
 			}
 		} else if(ts->ts_gesture == TSG2_ZOOM_OUT) {
 			if (ts->ts_count != 0)

==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/images/browser.png#5 (text+ko) ====

@@ -1,10 +1,46 @@
 PNG
 
--2?#9&@|O*""-,R{'"V[P{@-駟(:g?Vlٲxn61hР8Sg?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