#include <guacamole/protocol.h>
#include <freerdp/freerdp.h>
+#include <freerdp/utils/memory.h>
#include <freerdp/codec/color.h>
+#include <freerdp/codec/bitmap.h>
#include "client.h"
#include "rdp_bitmap.h"
/* 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) {
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;
+
}
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,