summaryrefslogtreecommitdiffstats
path: root/rdp
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2006-02-06 01:34:41 +0000
committerjsorg71 <jsorg71>2006-02-06 01:34:41 +0000
commitebb1afd2e878d198aca27840876e3a7dd262a8f6 (patch)
treee465f2ce2e58a610b13f9c6ab686e2deb94a37b4 /rdp
parent64bdbed95fcacb3c491109b8d5317cd2585f072a (diff)
downloadxrdp-proprietary-ebb1afd2e878d198aca27840876e3a7dd262a8f6.tar.gz
xrdp-proprietary-ebb1afd2e878d198aca27840876e3a7dd262a8f6.zip
uncompress bitmaps and big endian fixes
Diffstat (limited to 'rdp')
-rw-r--r--rdp/rdp_orders.c20
-rw-r--r--rdp/rdp_rdp.c18
2 files changed, 31 insertions, 7 deletions
diff --git a/rdp/rdp_orders.c b/rdp/rdp_orders.c
index 88f34fa6..2c5e8987 100644
--- a/rdp/rdp_orders.c
+++ b/rdp/rdp_orders.c
@@ -213,10 +213,9 @@ rdp_orders_process_raw_bmpcache(struct rdp_orders* self, struct stream* s,
int height;
int bpp;
int Bpp;
+ int x;
int y;
- char* data;
char* inverted;
- char* src;
char* dst;
struct rdp_bitmap* bitmap;
struct stream* rec_s;
@@ -229,13 +228,24 @@ rdp_orders_process_raw_bmpcache(struct rdp_orders* self, struct stream* s,
Bpp = (bpp + 7) / 8;
in_uint16_le(s, bufsize);
in_uint16_le(s, cache_idx);
- in_uint8p(s, data, bufsize);
inverted = (char*)g_malloc(width * height * Bpp, 0);
for (y = 0; y < height; y++)
{
- src = data + (y * (width * Bpp));
dst = inverted + (((height - y) - 1) * (width * Bpp));
- g_memcpy(dst, src, width * Bpp);
+ if (Bpp == 1)
+ {
+ for (x = 0; x < width; x++)
+ {
+ in_uint8(s, dst[x]);
+ }
+ }
+ else if (Bpp == 2)
+ {
+ for (x = 0; x < width; x++)
+ {
+ in_uint16_le(s, ((unsigned short*)dst)[x]);
+ }
+ }
}
bitmap = (struct rdp_bitmap*)g_malloc(sizeof(struct rdp_bitmap), 0);
bitmap->width = width;
diff --git a/rdp/rdp_rdp.c b/rdp/rdp_rdp.c
index 2b1c6791..00b8fa57 100644
--- a/rdp/rdp_rdp.c
+++ b/rdp/rdp_rdp.c
@@ -505,6 +505,7 @@ rdp_rdp_process_bitmap_updates(struct rdp_rdp* self, struct stream* s)
int bufsize;
int size;
int i;
+ int x;
int y;
char* data;
char* bmpdata0;
@@ -546,12 +547,25 @@ rdp_rdp_process_bitmap_updates(struct rdp_rdp* self, struct stream* s)
self->mod->server_paint_rect(self->mod, left, top, cx, cy, bmpdata1,
width, height, 0, 0);
}
- else
+ else /* not compressed */
{
for (y = 0; y < height; y++)
{
data = bmpdata0 + ((height - y) - 1) * (width * Bpp);
- in_uint8a(s, data, width * Bpp);
+ if (Bpp == 1)
+ {
+ for (x = 0; x < width; x++)
+ {
+ in_uint8(s, data[x]);
+ }
+ }
+ else if (Bpp == 2)
+ {
+ for (x = 0; x < width; x++)
+ {
+ in_uint16_le(s, ((unsigned short*)data)[x]);
+ }
+ }
}
bmpdata1 = rdp_orders_convert_bitmap(bpp, self->mod->xrdp_bpp,
bmpdata0, width, height,