GUACAMOLE-184: Only send contents of surface if non-empty.

This commit is contained in:
Michael Jumper 2016-09-12 23:05:18 -07:00
parent 5d5fbb4d45
commit bd3d482ade

View File

@ -1718,15 +1718,20 @@ void guac_common_surface_dup(guac_common_surface* surface, guac_user* user,
guac_protocol_send_size(socket, surface->layer, guac_protocol_send_size(socket, surface->layer,
surface->width, surface->height); surface->width, surface->height);
/* Get entire surface */ /* Send contents of layer, if non-empty */
cairo_surface_t* rect = cairo_image_surface_create_for_data( if (surface->width > 0 && surface->height > 0) {
surface->buffer, CAIRO_FORMAT_RGB24,
surface->width, surface->height, surface->stride);
/* Send PNG for rect */ /* Get entire surface */
guac_user_stream_png(user, socket, GUAC_COMP_OVER, surface->layer, cairo_surface_t* rect = cairo_image_surface_create_for_data(
0, 0, rect); surface->buffer, CAIRO_FORMAT_RGB24,
cairo_surface_destroy(rect); surface->width, surface->height, surface->stride);
/* Send PNG for rect */
guac_user_stream_png(user, socket, GUAC_COMP_OVER, surface->layer,
0, 0, rect);
cairo_surface_destroy(rect);
}
complete: complete:
pthread_mutex_unlock(&surface->_lock); pthread_mutex_unlock(&surface->_lock);