CVS: rdesktop bitmap.c, 1.28, 1.29 rdesktop.c, 1.160, 1.161 xwin.c, 1.225, 1.226

Jay Sorg <[email protected]> Wed, 29 Aug 2007 21:47:39 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16145

Modified Files:
	bitmap.c rdesktop.c xwin.c 
Log Message:
32 bit color

Index: bitmap.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/bitmap.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** bitmap.c	8 Jan 2007 04:47:05 -0000	1.28
--- bitmap.c	30 Aug 2007 04:47:36 -0000	1.29
***************
*** 747,750 ****
--- 747,884 ----
  }
  
+ /* decompress a colour plane */
+ static int
+ process_plane(uint8 * in, int width, int height, uint8 * out, int size)
+ {
+ 	int indexw;
+ 	int indexh;
+ 	int code;
+ 	int collen;
+ 	int replen;
+ 	int color;
+ 	int x;
+ 	int revcode;
+ 	uint8 * last_line;
+ 	uint8 * this_line;
+ 	uint8 * org_in;
+ 	uint8 * org_out;
+ 
+ 	org_in = in;
+ 	org_out = out;
+ 	last_line = 0;
+ 	indexh = 0;
+ 	while (indexh < height)
+ 	{
+ 		out = (org_out + width * height * 4) - ((indexh + 1) * width * 4);
+ 		color = 0;
+ 		this_line = out;
+ 		indexw = 0;
+ 		if (last_line == 0)
+ 		{
+ 			while (indexw < width)
+ 			{
+ 				code = CVAL(in);
+ 				replen = code & 0xf;
+ 				collen = (code >> 4) & 0xf;
+ 				revcode = (replen << 4) | collen;
+ 				if ((revcode <= 47) && (revcode >= 16))
+ 				{
+ 					replen = revcode;
+ 					collen = 0;
+ 				}
+ 				while (collen > 0)
+ 				{
+ 					color = CVAL(in);
+ 					*out = color;
+ 					out += 4;
+ 					indexw++;
+ 					collen--;
+ 				}
+ 				while (replen > 0)
+ 				{
+ 					*out = color;
+ 					out += 4;
+ 					indexw++;
+ 					replen--;
+ 				}
+ 			}
+ 		}
+ 		else
+ 		{
+ 			while (indexw < width)
+ 			{
+ 				code = CVAL(in);
+ 				replen = code & 0xf;
+ 				collen = (code >> 4) & 0xf;
+ 				revcode = (replen << 4) | collen;
+ 				if ((revcode <= 47) && (revcode >= 16))
+ 				{
+ 					replen = revcode;
+ 					collen = 0;
+ 				}
+ 				while (collen > 0)
+ 				{
+ 					x = CVAL(in);
+ 					if (x & 1)
+ 					{
+ 						x = x >> 1;
+ 						x = x + 1;
+ 						color = -x;
+ 					}
+ 					else
+ 					{
+ 						x = x >> 1;
+ 						color = x;
+ 					}
+ 					x = last_line[indexw * 4] + color;
+ 					*out = x;
+ 					out += 4;
+ 					indexw++;
+ 					collen--;
+ 				}
+ 				while (replen > 0)
+ 				{
+ 					x = last_line[indexw * 4] + color;
+ 					*out = x;
+ 					out += 4;
+ 					indexw++;
+ 					replen--;
+ 				}
+ 			}
+ 		}
+ 		indexh++;
+ 		last_line = this_line;
+ 	}
+ 	return (int) (in - org_in);
+ }
+ 
+ /* 4 byte bitmap decompress */
+ static RD_BOOL
+ bitmap_decompress4(uint8 * output, int width, int height, uint8 * input, int size)
+ {
+ 	int code;
+ 	int bytes_pro;
+ 	int total_pro;
+ 
+ 	code = CVAL(input);
+ 	if (code != 0x10)
+ 	{
+ 		return False;
+ 	}
+ 	total_pro = 1;
+ 	bytes_pro = process_plane(input, width, height, output + 3, size - total_pro);
+ 	total_pro += bytes_pro;
+ 	input += bytes_pro;
+ 	bytes_pro = process_plane(input, width, height, output + 2, size - total_pro);
+ 	total_pro += bytes_pro;
+ 	input += bytes_pro;
+ 	bytes_pro = process_plane(input, width, height, output + 1, size - total_pro);
+ 	total_pro += bytes_pro;
+ 	input += bytes_pro;
+ 	bytes_pro = process_plane(input, width, height, output + 0, size - total_pro);
+ 	total_pro += bytes_pro;
+ 	return size == total_pro;
+ }
+ 
  /* main decompress function */
  RD_BOOL
***************
*** 764,767 ****
--- 898,907 ----
  			rv = bitmap_decompress3(output, width, height, input, size);
  			break;
+ 		case 4:
+ 			rv = bitmap_decompress4(output, width, height, input, size);
+ 			break;
+ 		default:
+ 			unimpl("Bpp %d\n", Bpp);
+ 			break;
  	}
  	return rv;

Index: rdesktop.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -C2 -d -r1.160 -r1.161
*** rdesktop.c	10 Feb 2007 05:48:50 -0000	1.160
--- rdesktop.c	30 Aug 2007 04:47:36 -0000	1.161
***************
*** 634,638 ****
  				if (g_server_depth != 8 &&
  				    g_server_depth != 16 &&
! 				    g_server_depth != 15 && g_server_depth != 24)
  				{
  					error("Invalid server colour depth.\n");
--- 634,639 ----
  				if (g_server_depth != 8 &&
  				    g_server_depth != 16 &&
! 				    g_server_depth != 15 && g_server_depth != 24
! 				    && g_server_depth != 32)
  				{
  					error("Invalid server colour depth.\n");

Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.225
retrieving revision 1.226
diff -C2 -d -r1.225 -r1.226
*** xwin.c	18 Jun 2007 12:00:33 -0000	1.225
--- xwin.c	30 Aug 2007 04:47:36 -0000	1.226
***************
*** 584,587 ****
--- 584,588 ----
  			break;
  		case 24:
+ 		case 32:
  			SPLITCOLOUR24(colour, pc);
  			break;
***************
*** 1192,1195 ****
--- 1193,1203 ----
  	   changed during connection negotiations.
  	 */
+ 
+ 	/* todo */
+ 	if (g_server_depth == 32 && g_depth == 24)
+ 	{
+ 		return data;
+ 	}
+ 
  	if (g_no_translate_image)
  	{


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/