Fix artifacts.

This commit is contained in:
Michael Jumper 2012-04-10 11:51:46 -07:00
parent 18a1996f6b
commit 4de910748d

View File

@ -58,12 +58,12 @@ void __guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) {
guac_client* client = ((rdp_freerdp_context*) context)->client; guac_client* client = ((rdp_freerdp_context*) context)->client;
guac_socket* socket = client->socket; guac_socket* socket = client->socket;
/* Cache image data if present */
if (bitmap->data != NULL) {
/* Allocate buffer */ /* Allocate buffer */
guac_layer* buffer = guac_client_alloc_buffer(client); guac_layer* buffer = guac_client_alloc_buffer(client);
/* Cache image data if present */
if (bitmap->data != NULL) {
/* Create surface from image data */ /* Create surface from image data */
cairo_surface_t* surface = cairo_image_surface_create_for_data( cairo_surface_t* surface = cairo_image_surface_create_for_data(
bitmap->data, CAIRO_FORMAT_RGB24, bitmap->data, CAIRO_FORMAT_RGB24,
@ -76,11 +76,11 @@ void __guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) {
/* Free surface */ /* Free surface */
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
}
/* Store buffer reference in bitmap */ /* Store buffer reference in bitmap */
((guac_rdp_bitmap*) bitmap)->layer = buffer; ((guac_rdp_bitmap*) bitmap)->layer = buffer;
}
} }
@ -171,7 +171,10 @@ void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, boolean
else { else {
if (((guac_rdp_bitmap*) bitmap)->layer != NULL) /* If not available as a surface, make available. */
if (((guac_rdp_bitmap*) bitmap)->layer == NULL)
__guac_rdp_cache_bitmap(context, bitmap);
((rdp_guac_client_data*) client->data)->current_surface ((rdp_guac_client_data*) client->data)->current_surface
= ((guac_rdp_bitmap*) bitmap)->layer; = ((guac_rdp_bitmap*) bitmap)->layer;