PERFORCE change 219856 for review

Brooks Davis brooks at FreeBSD.org
Tue Nov 27 22:14:27 UTC 2012


http://p4web.freebsd.org/@@219856?ac=10

Change 219856 by brooks at brooks_zenith on 2012/11/27 22:14:22

	If a slide body is the full height of the framebuffer, render it
	without a header or the SRI and Cambride logos to make it easier
	to create alternate slide decks.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#12 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/cheripoint/cheripoint.c#12 (text+ko) ====

@@ -487,6 +487,7 @@
 {
 	int error, pfd;
 	int f_width, f_height;
+	int x, y, w, h;
 	uint sv1, sv2;
 	size_t olen;
 	char sntext[8];
@@ -509,7 +510,7 @@
 		sysctlbyname("security.cheri.syscall_violations",
 		    &sv1, &olen, NULL, 0);
 	}
-	if ((is = png_read_start(pfd, slide_width, fb_height, slidenum,
+	if ((is = png_read_start(pfd, fb_width, fb_height, slidenum,
 	    sb)) == NULL) {
 		warn("Failed to start PNG decode for %s", slide);
 		return (-1);
@@ -520,9 +521,27 @@
 	}
 	fb_fill_region(white, 0, 0, fb_width, fb_height);
 	busy(0);
-	fb_post_region(__DEVOLATILE(uint32_t *, is->buffer),
-	    slide_fcol + ((slide_width - is->width) / 2), header_height,
-	    is->width, is->height < slide_height ? is->height : slide_height);
+	/*
+	 * If the image is the full display height, assume it's meant to be
+	 * displayed as a simple slide without compositing.  Make a decent
+	 * effort to display it in a nice place horizontaly.
+	 */
+	if (is->height == (u_int)fb_height) {
+		y = 0;
+		h = is->height;
+	} else {
+		h = is->height < slide_height ? is->height : slide_height;
+		y = header_height;
+	}
+	if (is->width > slide_width) {
+		if (is->width < fb_width - slide_fcol)
+			x = slide_fcol;
+		else
+			x = 0;
+	} else
+		x = slide_fcol + ((slide_width - is->width) / 2);
+	w = is->width;
+	fb_post_region(__DEVOLATILE(uint32_t *, is->buffer), x, y, w, h);
 	if (sb_vis && sb != SB_NONE)
 		fb_rectangle(red, 2,
 		    slide_fcol + ((slide_width - is->width) / 2),
@@ -545,6 +564,12 @@
 	}
 	iboxstate_free(is);
 
+	/* Skip the rest in the full height image case */
+	if (y == 0) {
+		unbusy();
+		return (0);
+	}
+
 	busy(0);
 
 	/* put an SRI logo in the lower left corner */


More information about the p4-projects mailing list