Restored handling of ephemeral, fixed allocation of buffer in bitmap new.
This commit is contained in:
parent
1bb82d68f8
commit
72497211d9
@ -133,12 +133,12 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
|
||||
primary->MemBlt = guac_rdp_gdi_memblt;
|
||||
primary->OpaqueRect = guac_rdp_gdi_opaquerect;
|
||||
|
||||
/*pointer_cache_register_callbacks(instance->update);*/
|
||||
pointer_cache_register_callbacks(instance->update);
|
||||
glyph_cache_register_callbacks(instance->update);
|
||||
/*brush_cache_register_callbacks(instance->update);*/
|
||||
brush_cache_register_callbacks(instance->update);
|
||||
bitmap_cache_register_callbacks(instance->update);
|
||||
/*offscreen_cache_register_callbacks(instance->update);*/
|
||||
/*palette_cache_register_callbacks(instance->update);*/
|
||||
offscreen_cache_register_callbacks(instance->update);
|
||||
palette_cache_register_callbacks(instance->update);
|
||||
|
||||
/* Init channels (pre-connect) */
|
||||
if (freerdp_channels_pre_connect(channels, instance)) {
|
||||
|
@ -57,6 +57,12 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
guac_socket* socket = client->socket;
|
||||
|
||||
/* Allocate buffer */
|
||||
guac_layer* buffer = guac_client_alloc_buffer(client);
|
||||
|
||||
/* Store buffer reference in bitmap */
|
||||
((guac_rdp_bitmap*) bitmap)->layer = buffer;
|
||||
|
||||
/* Convert image data if present */
|
||||
if (bitmap->data != NULL) {
|
||||
|
||||
@ -66,12 +72,6 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
|
||||
context->instance->settings->color_depth,
|
||||
32, ((rdp_freerdp_context*) context)->clrconv);
|
||||
|
||||
/* If not ephemeral, send to client */
|
||||
if (!bitmap->ephemeral) {
|
||||
|
||||
/* Allocate buffer */
|
||||
guac_layer* buffer = guac_client_alloc_buffer(client);
|
||||
|
||||
/* Create surface from image data */
|
||||
cairo_surface_t* surface = cairo_image_surface_create_for_data(
|
||||
bitmap->data, CAIRO_FORMAT_RGB24,
|
||||
@ -83,13 +83,13 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
|
||||
/* Free surface */
|
||||
cairo_surface_destroy(surface);
|
||||
|
||||
/* If ephemeral, just free image data */
|
||||
if (!bitmap->ephemeral) {
|
||||
|
||||
/* Free image data if actually alloated */
|
||||
if (image_buffer != bitmap->data)
|
||||
free(image_buffer);
|
||||
|
||||
/* Store buffer reference in bitmap */
|
||||
((guac_rdp_bitmap*) bitmap)->layer = buffer;
|
||||
|
||||
}
|
||||
|
||||
/* Otherwise, store converted image in bitmap, free any existing */
|
||||
@ -102,9 +102,6 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
|
||||
/* Store converted image in bitmap */
|
||||
bitmap->data = image_buffer;
|
||||
|
||||
/* Not stored in a layer */
|
||||
((guac_rdp_bitmap*) bitmap)->layer = NULL;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -116,16 +113,12 @@ void guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap) {
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
guac_socket* socket = client->socket;
|
||||
|
||||
/* If not ephemeral, copy image data from buffer to visible layer */
|
||||
if (!bitmap->ephemeral)
|
||||
guac_protocol_send_copy(socket,
|
||||
((guac_rdp_bitmap*) bitmap)->layer,
|
||||
0, 0, bitmap->width, bitmap->height,
|
||||
GUAC_COMP_OVER,
|
||||
GUAC_DEFAULT_LAYER, bitmap->left, bitmap->top);
|
||||
|
||||
/* Otherwise, buffer apparently should not be drawn ... */
|
||||
|
||||
}
|
||||
|
||||
void guac_rdp_bitmap_free(rdpContext* context, rdpBitmap* bitmap) {
|
||||
@ -145,6 +138,7 @@ void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, boolean
|
||||
else
|
||||
((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) {
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <guacamole/client.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "rdp_bitmap.h"
|
||||
|
||||
void guac_rdp_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt) {
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
@ -57,8 +58,19 @@ void guac_rdp_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt) {
|
||||
}
|
||||
|
||||
void guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) {
|
||||
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
guac_client_log_info(client, "guac_rdp_gdi_memblt()");
|
||||
const guac_layer* current_layer = ((rdp_guac_client_data*) client->data)->current_surface;
|
||||
guac_socket* socket = client->socket;
|
||||
guac_rdp_bitmap* bitmap = (guac_rdp_bitmap*) memblt->bitmap;
|
||||
|
||||
if (bitmap->layer != NULL)
|
||||
guac_protocol_send_copy(socket,
|
||||
bitmap->layer,
|
||||
memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight,
|
||||
GUAC_COMP_OVER,
|
||||
current_layer, memblt->nLeftRect, memblt->nTopRect);
|
||||
|
||||
}
|
||||
|
||||
void guac_rdp_gdi_opaquerect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect) {
|
||||
|
Loading…
Reference in New Issue
Block a user