mike-jumper commented on code in PR #525: URL: https://github.com/apache/guacamole-server/pull/525#discussion_r1735401269
########## src/protocols/rdp/bitmap.c: ########## @@ -79,54 +82,53 @@ BOOL guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap) { guac_client* client = ((rdp_freerdp_context*) context)->client; guac_rdp_client* rdp_client = (guac_rdp_client*) client->data; - guac_common_display_layer* buffer = ((guac_rdp_bitmap*) bitmap)->layer; - - int width = bitmap->right - bitmap->left + 1; - int height = bitmap->bottom - bitmap->top + 1; + guac_display_layer* buffer = ((guac_rdp_bitmap*) bitmap)->layer; /* If not cached, cache if necessary */ if (buffer == NULL && ((guac_rdp_bitmap*) bitmap)->used >= 1) guac_rdp_cache_bitmap(context, bitmap); - /* If cached, retrieve from cache */ - if (buffer != NULL) - guac_common_surface_copy(buffer->surface, 0, 0, width, height, - rdp_client->display->default_surface, - bitmap->left, bitmap->top); - - /* Otherwise, draw with stored image data */ - else if (bitmap->data != NULL) { + guac_display_layer* default_layer = guac_display_default_layer(rdp_client->display); + guac_display_layer_raw_context* dst_context = guac_display_layer_open_raw(default_layer); - /* Create surface from image data */ - cairo_surface_t* image = cairo_image_surface_create_for_data( - bitmap->data, CAIRO_FORMAT_RGB24, - width, height, 4*bitmap->width); + guac_rect dst_rect = { + .left = bitmap->left, + .top = bitmap->top, + .right = bitmap->right, + .bottom = bitmap->bottom + }; - /* Draw image on default surface */ - guac_common_surface_draw(rdp_client->display->default_surface, - bitmap->left, bitmap->top, image); + guac_rect_constrain(&dst_rect, &dst_context->bounds); - /* Free surface */ - cairo_surface_destroy(image); + /* If cached, retrieve from cache */ + if (buffer != NULL) { + guac_display_layer_raw_context* src_context = guac_display_layer_open_raw(buffer); + guac_display_layer_raw_context_put(dst_context, &dst_rect, src_context->buffer, src_context->stride); + } + /* Otherwise, draw with stored image data */ + else if (bitmap->data != NULL) { + guac_display_layer_raw_context_put(dst_context, &dst_rect, bitmap->data, 4 * bitmap->width); Review Comment: Each pixel within the image data at `bitmap->data` is 32-bit. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@guacamole.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org