Only cache bitmap on client if not ephemeral.
This commit is contained in:
parent
4710994bc3
commit
e75e6bbb53
@ -73,20 +73,21 @@ void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
|
|||||||
context->instance->settings->color_depth,
|
context->instance->settings->color_depth,
|
||||||
32, ((rdp_freerdp_context*) context)->clrconv);
|
32, ((rdp_freerdp_context*) context)->clrconv);
|
||||||
|
|
||||||
/* Create surface from image data */
|
/* If not ephemeral, store cached image, and free image data */
|
||||||
cairo_surface_t* surface = cairo_image_surface_create_for_data(
|
|
||||||
image_buffer, CAIRO_FORMAT_RGB24,
|
|
||||||
bitmap->width, bitmap->height, 4*bitmap->width);
|
|
||||||
|
|
||||||
/* Send surface to buffer */
|
|
||||||
guac_protocol_send_png(socket, GUAC_COMP_SRC, buffer, 0, 0, surface);
|
|
||||||
|
|
||||||
/* Free surface */
|
|
||||||
cairo_surface_destroy(surface);
|
|
||||||
|
|
||||||
/* If ephemeral, just free image data */
|
|
||||||
if (!bitmap->ephemeral) {
|
if (!bitmap->ephemeral) {
|
||||||
|
|
||||||
|
/* Create surface from image data */
|
||||||
|
cairo_surface_t* surface = cairo_image_surface_create_for_data(
|
||||||
|
image_buffer, CAIRO_FORMAT_RGB24,
|
||||||
|
bitmap->width, bitmap->height, 4*bitmap->width);
|
||||||
|
|
||||||
|
/* Send surface to buffer */
|
||||||
|
guac_protocol_send_png(socket,
|
||||||
|
GUAC_COMP_SRC, buffer, 0, 0, surface);
|
||||||
|
|
||||||
|
/* Free surface */
|
||||||
|
cairo_surface_destroy(surface);
|
||||||
|
|
||||||
/* Free image data if actually alloated */
|
/* Free image data if actually alloated */
|
||||||
if (image_buffer != bitmap->data)
|
if (image_buffer != bitmap->data)
|
||||||
free(image_buffer);
|
free(image_buffer);
|
||||||
@ -117,11 +118,31 @@ void guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap) {
|
|||||||
int width = bitmap->right - bitmap->left + 1;
|
int width = bitmap->right - bitmap->left + 1;
|
||||||
int height = bitmap->bottom - bitmap->top + 1;
|
int height = bitmap->bottom - bitmap->top + 1;
|
||||||
|
|
||||||
guac_protocol_send_copy(socket,
|
/* If not ephemeral, retrieve from cache */
|
||||||
((guac_rdp_bitmap*) bitmap)->layer,
|
if (!bitmap->ephemeral)
|
||||||
0, 0, width, height,
|
guac_protocol_send_copy(socket,
|
||||||
GUAC_COMP_OVER,
|
((guac_rdp_bitmap*) bitmap)->layer,
|
||||||
GUAC_DEFAULT_LAYER, bitmap->left, bitmap->top);
|
0, 0, width, height,
|
||||||
|
GUAC_COMP_OVER,
|
||||||
|
GUAC_DEFAULT_LAYER, bitmap->left, bitmap->top);
|
||||||
|
|
||||||
|
/* Otherwise, draw with stored image data */
|
||||||
|
else if (bitmap->data != NULL) {
|
||||||
|
|
||||||
|
/* Create surface from image data */
|
||||||
|
cairo_surface_t* surface = cairo_image_surface_create_for_data(
|
||||||
|
bitmap->data, CAIRO_FORMAT_RGB24,
|
||||||
|
width, height, 4*bitmap->width);
|
||||||
|
|
||||||
|
/* Send surface to buffer */
|
||||||
|
guac_protocol_send_png(socket,
|
||||||
|
GUAC_COMP_OVER, GUAC_DEFAULT_LAYER,
|
||||||
|
bitmap->left, bitmap->top, surface);
|
||||||
|
|
||||||
|
/* Free surface */
|
||||||
|
cairo_surface_destroy(surface);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user