GUAC-852: Add bitmap_decompress implementation (partial stub - will not work with older FreeRDP).
This commit is contained in:
parent
450db1657e
commit
e2c28d9240
@ -77,7 +77,7 @@ void guac_rdp_cache_bitmap(rdpContext* context, rdpBitmap* bitmap) {
|
||||
void guac_rdp_bitmap_new(rdpContext* context, rdpBitmap* bitmap) {
|
||||
|
||||
/* Convert image data if present */
|
||||
if (bitmap->data != NULL) {
|
||||
if (bitmap->data != NULL && bitmap->bpp != 32) {
|
||||
|
||||
/* Convert image data to 32-bit RGB */
|
||||
unsigned char* image_buffer = freerdp_image_convert(bitmap->data, NULL,
|
||||
@ -185,6 +185,30 @@ void guac_rdp_bitmap_setsurface(rdpContext* context, rdpBitmap* bitmap, BOOL pri
|
||||
|
||||
}
|
||||
|
||||
static void bitmap_decompress(rdpContext* context,
|
||||
BYTE* srcData, int size, int srcBpp, int width, int height,
|
||||
BYTE* dstData) {
|
||||
|
||||
rdpCodecs* codecs = context->codecs;
|
||||
guac_client* client = ((rdp_freerdp_context*) context)->client;
|
||||
|
||||
/* Decode as interleaved if less than 32 bits per pixel */
|
||||
if (srcBpp < 32) {
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
|
||||
interleaved_decompress(codecs->interleaved, srcData, size, srcBpp,
|
||||
&dstData, PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height, NULL);
|
||||
}
|
||||
|
||||
/* Otherwise, decode as planar */
|
||||
else {
|
||||
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
|
||||
planar_decompress(codecs->planar, srcData, size,
|
||||
&dstData, PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height, TRUE);
|
||||
guac_client_log(client, GUAC_LOG_DEBUG, "Decompressed planar.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef LEGACY_RDPBITMAP
|
||||
void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* data,
|
||||
int width, int height, int bpp, int length, BOOL compressed) {
|
||||
@ -193,21 +217,18 @@ void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* d
|
||||
int width, int height, int bpp, int length, BOOL compressed, int codec_id) {
|
||||
#endif
|
||||
|
||||
int size = width * height * (bpp + 7) / 8;
|
||||
int size = width * height * 4;
|
||||
|
||||
if (bitmap->data == NULL)
|
||||
bitmap->data = (UINT8*) malloc(size);
|
||||
else
|
||||
bitmap->data = (UINT8*) realloc(bitmap->data, size);
|
||||
bitmap->data = (UINT8*) _aligned_malloc(size, 16);
|
||||
|
||||
if (compressed)
|
||||
bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp);
|
||||
bitmap_decompress(context, data, length, bpp, width, height, bitmap->data);
|
||||
else
|
||||
freerdp_image_flip(data, bitmap->data, width, height, bpp);
|
||||
|
||||
bitmap->compressed = FALSE;
|
||||
bitmap->length = size;
|
||||
bitmap->bpp = bpp;
|
||||
bitmap->bpp = 32;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user