PERFORCE change 229058 for review

Philip Withnall prw35 at FreeBSD.org
Mon May 27 15:22:11 UTC 2013


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

Change 229058 by prw35 at pwithnall_zenith on 2013/05/27 15:21:22

	compositorctl: Fix width of image during initialisation
	
	Ensure that the excess due to the row stride is filled with alpha.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/ctsrd/compositorctl/compositorctl.c#2 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/compositorctl/compositorctl.c#2 (text+ko) ====

@@ -37,6 +37,7 @@
 #include <sys/endian.h>
 #include <sys/ioccom.h>
 #include <sys/mman.h>
+#include <sys/param.h>
 #include <sys/types.h>
 #include <unistd.h>
 
@@ -751,7 +752,7 @@
 	struct compositor_mapping secure_compositor;
 	int retval = 0;
 	struct compositor_rgba_pixel overlay_bg_colour = {
-		.red = 0, .green = 0xff, .blue = 0, .alpha = 0xa0
+		.red = 0, .green = 0xa0, .blue = 0, .alpha = 0xa0
 	};
 	struct compositor_rgba_pixel overlay_border_colour = {
 		.red = 0, .green = 0xff, .blue = 0xff, .alpha = 0xff
@@ -845,7 +846,8 @@
 	printf("Writing crest tile data…\n");
 
 	compositor_write_cfb_data_image(crest_cfb_id,
-	                                crest_image.width, crest_image.height,
+	                                ROUND_UP(crest_image.width, TILE_SIZE),
+	                                ROUND_UP(crest_image.height, TILE_SIZE),
 	                                crest_image.width, crest_image.height,
 	                                (const uint32_t *) ((const void *) crest_image.pixel_data));
 
@@ -913,11 +915,19 @@
 		}
 
 		/* Change the colours for the next one. */
-		overlay_bg_colour.red += 0x30;
-		overlay_bg_colour.green -= 0x30;
 		overlay_bg_colour.alpha -= 0x20;
-		overlay_border_colour.red += 0x30;
-		overlay_border_colour.green -= 0x30;
+		overlay_bg_colour.red =
+			MIN(overlay_bg_colour.alpha,
+			    overlay_bg_colour.red + 0x30);
+		overlay_bg_colour.green =
+			MIN(overlay_bg_colour.alpha,
+			    overlay_bg_colour.green - 0x30);
+		overlay_border_colour.red =
+			MIN(overlay_border_colour.alpha,
+			    overlay_border_colour.red + 0x30);
+		overlay_border_colour.green =
+			MIN(overlay_border_colour.alpha,
+			    overlay_border_colour.green - 0x30);
 	}
 
 


More information about the p4-projects mailing list