From 513a72e4d55315c2ac432d89939eca2f0f88a87a Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Sun, 15 Jun 2008 22:26:15 +0000 Subject: [PATCH] added more color conversion --- rdp/rdp_orders.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/rdp/rdp_orders.c b/rdp/rdp_orders.c index 020d6167..4bc4d057 100644 --- a/rdp/rdp_orders.c +++ b/rdp/rdp_orders.c @@ -1358,10 +1358,87 @@ rdp_orders_convert_bitmap(int in_bpp, int out_bpp, char* bmpdata, } return out; } + if ((in_bpp == 8) && (out_bpp == 24)) + { + out = (char*)g_malloc(width * height * 4, 0); + src = bmpdata; + dst = out; + for (i = 0; i < height; i++) + { + for (j = 0; j < width; j++) + { + pixel = *((tui8*)src); + pixel = palette[pixel]; + SPLITCOLOR32(red, green, blue, pixel); + pixel = COLOR24RGB(red, green, blue); + *((tui32*)dst) = pixel; + src++;; + dst += 4; + } + } + return out; + } + if ((in_bpp == 15) && (out_bpp == 16)) + { + out = (char*)g_malloc(width * height * 2, 0); + src = bmpdata; + dst = out; + for (i = 0; i < height; i++) + { + for (j = 0; j < width; j++) + { + pixel = *((tui16*)src); + SPLITCOLOR15(red, green, blue, pixel); + pixel = COLOR16(red, green, blue); + *((tui16*)dst) = pixel; + src += 2; + dst += 2; + } + } + return out; + } + if ((in_bpp == 15) && (out_bpp == 24)) + { + out = (char*)g_malloc(width * height * 4, 0); + src = bmpdata; + dst = out; + for (i = 0; i < height; i++) + { + for (j = 0; j < width; j++) + { + pixel = *((tui16*)src); + SPLITCOLOR15(red, green, blue, pixel); + pixel = COLOR24RGB(red, green, blue); + *((tui32*)dst) = pixel; + src += 2; + dst += 4; + } + } + return out; + } if ((in_bpp == 16) && (out_bpp == 16)) { return bmpdata; } + if ((in_bpp == 16) && (out_bpp == 24)) + { + out = (char*)g_malloc(width * height * 4, 0); + src = bmpdata; + dst = out; + for (i = 0; i < height; i++) + { + for (j = 0; j < width; j++) + { + pixel = *((tui16*)src); + SPLITCOLOR16(red, green, blue, pixel); + pixel = COLOR24RGB(red, green, blue); + *((tui32*)dst) = pixel; + src += 2; + dst += 4; + } + } + return out; + } if ((in_bpp == 24) && (out_bpp == 24)) { out = (char*)g_malloc(width * height * 4, 0); @@ -1411,10 +1488,38 @@ rdp_orders_convert_color(int in_bpp, int out_bpp, int in_color, int* palette) pixel = COLOR16(red, green, blue); return pixel; } + if ((in_bpp == 8) && (out_bpp == 24)) + { + pixel = palette[in_color]; + SPLITCOLOR32(red, green, blue, pixel); + pixel = COLOR24BGR(red, green, blue); + return pixel; + } + if ((in_bpp == 15) && (out_bpp == 16)) + { + pixel = in_color; + SPLITCOLOR15(red, green, blue, pixel); + pixel = COLOR16(red, green, blue); + return pixel; + } + if ((in_bpp == 15) && (out_bpp == 24)) + { + pixel = in_color; + SPLITCOLOR15(red, green, blue, pixel); + pixel = COLOR24BGR(red, green, blue); + return pixel; + } if ((in_bpp == 16) && (out_bpp == 16)) { return in_color; } + if ((in_bpp == 16) && (out_bpp == 24)) + { + pixel = in_color; + SPLITCOLOR16(red, green, blue, pixel); + pixel = COLOR24BGR(red, green, blue); + return pixel; + } if ((in_bpp == 24) && (out_bpp == 24)) { return in_color;