CVS: rdesktop xwin.c,1.157,1.158

Jay Sorg <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29587

Modified Files:
	xwin.c 
Log Message:
if rdp server and client bpp match and architectures match, don't translate image

Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -C2 -d -r1.157 -r1.158
*** xwin.c	24 Mar 2004 18:16:58 -0000	1.157
--- xwin.c	25 Mar 2004 22:58:45 -0000	1.158
***************
*** 58,61 ****
--- 58,62 ----
  static BOOL g_focused;
  static BOOL g_mouse_in_wnd;
+ static BOOL g_arch_match = False; /* set to True if RGB XServer and little endian */
  
  /* endianness */
***************
*** 598,604 ****
  translate_image(int width, int height, uint8 * data)
  {
! 	int size = width * height * g_bpp / 8;
! 	uint8 *out = (uint8 *) xmalloc(size);
! 	uint8 *end = out + size;
  
  	switch (g_server_bpp)
--- 599,617 ----
  translate_image(int width, int height, uint8 * data)
  {
! 	int size;
! 	uint8 *out;
! 	uint8 *end;
! 
! 	/* if server and xserver bpp match, */
! 	/* and arch(endian) matches, no need to translate */
! 	/* just return data */
! 	if (g_depth > 8)
! 		if (g_arch_match)
! 			if (g_depth == g_server_bpp)
! 				return data;
! 
! 	size = width * height * (g_bpp / 8);
! 	out = (uint8 *) xmalloc(size);
! 	end = out + size;
  
  	switch (g_server_bpp)
***************
*** 738,741 ****
--- 751,758 ----
  	}
  
+ 	test = 1;
+ 	g_host_be = !(BOOL) (*(uint8 *) (&test));
+ 	g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);
+ 
  	if ((g_server_bpp == 8) && ((!TrueColorVisual) || (g_depth <= 8)))
  	{
***************
*** 764,767 ****
--- 781,789 ----
  		calculate_shifts(vi.blue_mask, &g_blue_shift_r, &g_blue_shift_l);
  		calculate_shifts(vi.green_mask, &g_green_shift_r, &g_green_shift_l);
+ 
+ 		/* if RGB video and averything is little endian */
+ 		if (vi.red_mask > vi.green_mask && vi.green_mask > vi.blue_mask)
+ 			if (!g_xserver_be && !g_host_be)
+ 				g_arch_match = True;
  	}
  
***************
*** 803,810 ****
  	}
  
- 	test = 1;
- 	g_host_be = !(BOOL) (*(uint8 *) (&test));
- 	g_xserver_be = (ImageByteOrder(g_display) == MSBFirst);
- 
  	/*
  	 * Determine desktop size
--- 825,828 ----
***************
*** 1382,1386 ****
  
  	XFree(image);
! 	if (!g_owncolmap)
  		xfree(tdata);
  	return (HBITMAP) bitmap;
--- 1400,1404 ----
  
  	XFree(image);
! 	if (tdata != data)
  		xfree(tdata);
  	return (HBITMAP) bitmap;
***************
*** 1421,1425 ****
  
  	XFree(image);
! 	if (!g_owncolmap)
  		xfree(tdata);
  }
--- 1439,1443 ----
  
  	XFree(image);
! 	if (tdata != data)
  		xfree(tdata);
  }



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.