From 73bdb57ee27221f8bcce35b895afdb0df9fbb801 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 10 Jun 2014 17:49:15 -0700 Subject: [PATCH] more fixes for 32 bit color --- libxrdp/xrdp_bitmap32_compress.c | 34 ++++++++++++++++++++++++-------- xorg/X11R7.6/rdp/rdpup.c | 4 ++-- xup/xup.c | 6 +++--- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/libxrdp/xrdp_bitmap32_compress.c b/libxrdp/xrdp_bitmap32_compress.c index b1aaaa9a..6af7ed75 100644 --- a/libxrdp/xrdp_bitmap32_compress.c +++ b/libxrdp/xrdp_bitmap32_compress.c @@ -49,17 +49,20 @@ xrdp_bitmap32_compress(char *in_data, int width, int height, int jindex; int cx; int cy; + int header; - alpha_data = g_malloc(width * height * 4, 0); - red_data = alpha_data + width * height; - green_data = red_data + width * height; - blue_data = green_data + width * height; + header = 0x20; /* no alpha TODO */ + + cx = width + e; + cy = 0; + alpha_data = g_malloc(cx * height * 4, 0); + red_data = alpha_data + cx * height; + green_data = red_data + cx * height; + blue_data = green_data + cx * height; alpha_bytes = 0; red_bytes = 0; green_bytes = 0; blue_bytes = 0; - cx = width; - cy = 0; /* split planes */ while (start_line >= 0) @@ -78,14 +81,29 @@ xrdp_bitmap32_compress(char *in_data, int width, int height, blue_data[blue_bytes] = pixel >> 0; blue_bytes++; } + for (iindex = 0; iindex < e; iindex++) + { + alpha_data[alpha_bytes] = 0; + alpha_bytes++; + red_data[red_bytes] = 0; + red_bytes++; + green_data[green_bytes] = 0; + green_bytes++; + blue_data[blue_bytes] = 0; + blue_bytes++; + } start_line--; cy++; } - out_uint8(s, 0x20); /* no alpha */ + out_uint8(s, header); out_uint8a(s, red_data, red_bytes); out_uint8a(s, green_data, green_bytes); out_uint8a(s, blue_data, blue_bytes); - out_uint8(s, 0x00); + if ((header & 0x10) == 0) + { + /* pad if no RLE */ + out_uint8(s, 0x00); + } g_free(alpha_data); return cy; } diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 83525251..e7f504ec 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -1563,7 +1563,7 @@ convert_pixel(int in_pixel) if (g_rdpScreen.depth == 24) { - if (g_rdpScreen.rdp_bpp == 24) + if (g_rdpScreen.rdp_bpp >= 24) { rv = in_pixel; SPLITCOLOR32(red, green, blue, rv); @@ -1619,7 +1619,7 @@ convert_pixels(void *src, void *dst, int num_pixels) { src32 = (unsigned int *)src; - if (g_rdpScreen.rdp_bpp == 24) + if (g_rdpScreen.rdp_bpp >= 24) { dst32 = (unsigned int *)dst; diff --git a/xup/xup.c b/xup/xup.c index 95161f96..f1ddf4c2 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -178,11 +178,11 @@ lib_mod_connect(struct mod *mod) mod->server_msg(mod, "started connecting", 0); - /* only support 8, 15, 16, and 24 bpp connections from rdp client */ - if (mod->bpp != 8 && mod->bpp != 15 && mod->bpp != 16 && mod->bpp != 24) + /* only support 8, 15, 16, 24, and 32 bpp connections from rdp client */ + if (mod->bpp != 8 && mod->bpp != 15 && mod->bpp != 16 && mod->bpp != 24 && mod->bpp != 32) { mod->server_msg(mod, - "error - only supporting 8, 15, 16, and 24 bpp rdp connections", 0); + "error - only supporting 8, 15, 16, 24, and 32 bpp rdp connections", 0); LIB_DEBUG(mod, "out lib_mod_connect error"); return 1; }