From c9fd83c77bf450ebf12b58a0de0e8a0211fe6ccd Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 10 Jan 2012 23:31:24 -0800 Subject: [PATCH] Implemented set surface, removed unneeded debug logs. --- protocols/rdp/src/rdp_bitmap.c | 34 ++++++++++++++++++++++------------ protocols/rdp/src/rdp_gdi.c | 4 +++- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/protocols/rdp/src/rdp_bitmap.c b/protocols/rdp/src/rdp_bitmap.c index af915ce1..4db17827 100644 --- a/protocols/rdp/src/rdp_bitmap.c +++ b/protocols/rdp/src/rdp_bitmap.c @@ -45,7 +45,9 @@ #include #include +#include #include +#include #include "client.h" #include "rdp_bitmap.h" @@ -85,9 +87,6 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) { /* Store buffer reference in bitmap */ ((guac_rdp_bitmap*) bitmap)->layer = buffer; - - guac_client_log_info(client, "guac_rdp_bitmap_new()"); - } void guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap) { @@ -101,26 +100,37 @@ void guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap) { 0, 0, bitmap->width, bitmap->height, GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, bitmap->left, bitmap->top); - - guac_client_log_info(client, "guac_rdp_bitmap_paint()"); - } void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap) { guac_client* client = ((rdp_freerdp_context*) context)->client; guac_client_free_buffer(client, ((guac_rdp_bitmap*) bitmap)->layer); - - guac_client_log_info(client, "guac_rdp_bitmap_free()"); - } void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, boolean primary) { guac_client* client = ((rdp_freerdp_context*) context)->client; - guac_client_log_info(client, "guac_rdp_bitmap_setsurface()"); + + ((rdp_guac_client_data*) client->data)->current_surface + = ((guac_rdp_bitmap*) bitmap)->layer; } void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, uint8* data, int width, int height, int bpp, int length, boolean compressed) { - guac_client* client = ((rdp_freerdp_context*) context)->client; - guac_client_log_info(client, "guac_rdp_bitmap_decompress()"); + + int size = width * height * (bpp + 7) / 8; + + if (bitmap->data == NULL) + bitmap->data = (uint8*) xmalloc(size); + else + bitmap->data = (uint8*) xrealloc(bitmap->data, size); + + if (compressed) + bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); + else + freerdp_image_flip(data, bitmap->data, width, height, bpp); + + bitmap->compressed = false; + bitmap->length = size; + bitmap->bpp = bpp; + } diff --git a/protocols/rdp/src/rdp_gdi.c b/protocols/rdp/src/rdp_gdi.c index 5e5ea203..9c8884f0 100644 --- a/protocols/rdp/src/rdp_gdi.c +++ b/protocols/rdp/src/rdp_gdi.c @@ -67,8 +67,10 @@ void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect uint32 color = freerdp_color_convert(opaque_rect->color, context->instance->settings->color_depth, 32, &guac_rdp_clrconv); + const guac_layer* current_layer = ((rdp_guac_client_data*) client->data)->current_surface; + guac_protocol_send_rect(client->socket, - GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, + GUAC_COMP_OVER, current_layer, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight, (color >> 16) & 0xFF,