GUACAMOLE-249: Remove unnecessary bitmap conversion - will happen automatically when FreeRDP invokes bitmap->Decompress().

This commit is contained in:
Michael Jumper 2020-01-04 00:00:21 -08:00
parent 902c5e1bd4
commit 555973f6b0
3 changed files with 0 additions and 56 deletions

View File

@ -37,31 +37,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
BOOL guac_rdp_bitmap_convert(rdpContext* context, rdpBitmap* bitmap) {
/* No need to convert if there is no image data or the image data is
* already in the format used by libguac (the format used by Cairo) */
if (bitmap->data == NULL || bitmap->format == PIXEL_FORMAT_BGRX32)
return TRUE;
/* Allocate sufficient space for converted image */
unsigned char* image_buffer = _aligned_malloc(bitmap->width * bitmap->height * 4, 16);
/* Attempt image conversion, replacing existing image data if successful */
if (freerdp_image_copy(image_buffer, PIXEL_FORMAT_BGRX32, 0, 0, 0,
bitmap->width, bitmap->height, bitmap->data, bitmap->format,
0, 0, 0, &context->gdi->palette, FREERDP_FLIP_NONE)) {
_aligned_free(bitmap->data);
bitmap->data = image_buffer;
bitmap->format = PIXEL_FORMAT_BGRX32;
return TRUE;
}
_aligned_free(image_buffer);
return FALSE;
}
BOOL guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) { BOOL guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) {
guac_client* client = ((rdp_freerdp_context*) context)->client; guac_client* client = ((rdp_freerdp_context*) context)->client;
@ -74,9 +49,6 @@ BOOL guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) {
/* Cache image data if present */ /* Cache image data if present */
if (bitmap->data != NULL) { if (bitmap->data != NULL) {
/* Convert image data to format used by libguac */
guac_rdp_bitmap_convert(context, bitmap);
/* Create surface from image data */ /* Create surface from image data */
cairo_surface_t* image = cairo_image_surface_create_for_data( cairo_surface_t* image = cairo_image_surface_create_for_data(
bitmap->data, CAIRO_FORMAT_RGB24, bitmap->data, CAIRO_FORMAT_RGB24,
@ -99,9 +71,6 @@ BOOL guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) {
BOOL guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) { BOOL guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
/* Convert image data to format used by libguac */
guac_rdp_bitmap_convert(context, bitmap);
/* No corresponding surface yet - caching is deferred. */ /* No corresponding surface yet - caching is deferred. */
((guac_rdp_bitmap*) bitmap)->layer = NULL; ((guac_rdp_bitmap*) bitmap)->layer = NULL;
@ -135,9 +104,6 @@ BOOL guac_rdp_bitmap_paint(rdpContext* context, rdpBitmap* bitmap) {
/* Otherwise, draw with stored image data */ /* Otherwise, draw with stored image data */
else if (bitmap->data != NULL) { else if (bitmap->data != NULL) {
/* Convert image data to format used by libguac */
guac_rdp_bitmap_convert(context, bitmap);
/* Create surface from image data */ /* Create surface from image data */
cairo_surface_t* image = cairo_image_surface_create_for_data( cairo_surface_t* image = cairo_image_surface_create_for_data(
bitmap->data, CAIRO_FORMAT_RGB24, bitmap->data, CAIRO_FORMAT_RGB24,

View File

@ -49,25 +49,6 @@ typedef struct guac_rdp_bitmap {
} guac_rdp_bitmap; } guac_rdp_bitmap;
/**
* Converts the image data within the given rdpBitmap to the pixel format used
* by libguac (Cairo) for 24-bit RGB images lacking an alpha channel. Any
* existing image data within the bitmap is freed and replaced with
* newly-allocated image data in the needed format, and the format field of the
* rdpBitmap is updated to match.
*
* @param context
* The rdpContext associated with the current RDP session.
*
* @param bitmap
* The rdpBitmap to convert.
*
* @return
* TRUE if image conversion was successful or there was no image data to
* convert, FALSE otherwise.
*/
BOOL guac_rdp_bitmap_convert(rdpContext* context, rdpBitmap* bitmap);
/** /**
* Caches the given bitmap immediately, storing its data in a remote Guacamole * Caches the given bitmap immediately, storing its data in a remote Guacamole
* buffer. As RDP bitmaps are frequently created, used once, and immediately * buffer. As RDP bitmaps are frequently created, used once, and immediately

View File

@ -274,9 +274,6 @@ BOOL guac_rdp_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) {
if (bitmap->layer == NULL) { if (bitmap->layer == NULL) {
if (memblt->bitmap->data != NULL) { if (memblt->bitmap->data != NULL) {
/* Convert image data to format used by libguac */
guac_rdp_bitmap_convert(context, memblt->bitmap);
/* 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(
memblt->bitmap->data + 4*(x_src + y_src*memblt->bitmap->width), memblt->bitmap->data + 4*(x_src + y_src*memblt->bitmap->width),