Beispiel #1
0
/**
 * Set Width/Height/BitDepth according to passed GEMRES_640x480,
 * GEMRES_800x600, GEMRES_OTHER. Align size when necessary.
 */
void VDI_SetResolution(int GEMColor, int WidthRequest, int HeightRequest)
{
	/* Color depth */
	switch (GEMColor)
	{
	 case GEMCOLOR_2:
		VDIRes = 2;
		VDIPlanes = 1;
		VDIColors = 2;
		VDICharHeight = 16;
		break;
	 case GEMCOLOR_4:
		VDIRes = 1;
		VDIPlanes = 2;
		VDIColors = 4;
		VDICharHeight = 8;
		break;
	 case GEMCOLOR_16:
		VDIRes = 0;
		VDIPlanes = 4;
		VDIColors = 16;
		VDICharHeight = 8;
		break;
	}

	/* width needs to be aligned to 16 bytes */
	VDIWidth = VDI_Limit(WidthRequest, 128/VDIPlanes, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
	/* height needs to be multiple of cell height */
	VDIHeight = VDI_Limit(HeightRequest, VDICharHeight, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
	printf("VDI screen: request = %dx%d@%d, aligned result = %dx%d@%d\n",
	       WidthRequest, HeightRequest, VDIPlanes, VDIWidth, VDIHeight, VDIPlanes);

	/* Write resolution to re-boot takes effect with correct bit-depth */
	VDI_FixDesktopInf();
}
Beispiel #2
0
/**
 * Set Width/Height/BitDepth according to passed GEMCOLOR_2/4/16.
 * Align size when necessary.
 */
void VDI_SetResolution(int GEMColor, int WidthRequest, int HeightRequest)
{
	int w = WidthRequest;
	int h = HeightRequest;

	/* Color depth */
	switch (GEMColor)
	{
	 case GEMCOLOR_2:
		VDIRes = 2;
		VDIPlanes = 1;
		break;
	 case GEMCOLOR_4:
		VDIRes = 1;
		VDIPlanes = 2;
		break;
	 case GEMCOLOR_16:
		VDIRes = 0;
		VDIPlanes = 4;
		break;
	}
	/* screen size in bytes needs to be below limit */
	VDI_ByteLimit(&w, &h, VDIPlanes);

	/* width needs to be aligned to 16 bytes */
	VDIWidth = VDI_Limit(w, 128/VDIPlanes, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
	/* height needs to be multiple of cell height (either 8 or 16) */
	VDIHeight = VDI_Limit(h, 16, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);

	printf("VDI screen: request = %dx%d@%d, result = %dx%d@%d\n",
	       WidthRequest, HeightRequest, VDIPlanes, VDIWidth, VDIHeight, VDIPlanes);

	/* Write resolution to re-boot takes effect with correct bit-depth */
	VDI_FixDesktopInf();
}