32 bit color
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1416 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
190c138e53
commit
5d1527d1b6
140
bitmap.c
140
bitmap.c
@ -746,6 +746,140 @@ bitmap_decompress3(uint8 * output, int width, int height, uint8 * input, int siz
|
||||
return True;
|
||||
}
|
||||
|
||||
/* 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
|
||||
bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int size, int Bpp)
|
||||
@ -763,6 +897,12 @@ bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int size
|
||||
case 3:
|
||||
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;
|
||||
}
|
||||
|
@ -633,7 +633,8 @@ main(int argc, char *argv[])
|
||||
g_server_depth = strtol(optarg, NULL, 10);
|
||||
if (g_server_depth != 8 &&
|
||||
g_server_depth != 16 &&
|
||||
g_server_depth != 15 && g_server_depth != 24)
|
||||
g_server_depth != 15 && g_server_depth != 24
|
||||
&& g_server_depth != 32)
|
||||
{
|
||||
error("Invalid server colour depth.\n");
|
||||
return 1;
|
||||
|
8
xwin.c
8
xwin.c
@ -583,6 +583,7 @@ translate_colour(uint32 colour)
|
||||
SPLITCOLOUR16(colour, pc);
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
SPLITCOLOUR24(colour, pc);
|
||||
break;
|
||||
default:
|
||||
@ -1191,6 +1192,13 @@ translate_image(int width, int height, uint8 * data)
|
||||
is only set for compatible depths, but the RDP depth might've
|
||||
changed during connection negotiations.
|
||||
*/
|
||||
|
||||
/* todo */
|
||||
if (g_server_depth == 32 && g_depth == 24)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
if (g_no_translate_image)
|
||||
{
|
||||
if ((g_depth == 15 && g_server_depth == 15) ||
|
||||
|
Loading…
Reference in New Issue
Block a user