diff --git a/configure.ac b/configure.ac index 289b0688..ff69e303 100644 --- a/configure.ac +++ b/configure.ac @@ -429,7 +429,12 @@ if test "x${have_freerdp}" = "xyes" then AC_CHECK_DECL([freerdp_convert_gdi_order_color], [AC_DEFINE([HAVE_FREERDP_CONVERT_GDI_ORDER_COLOR],, - [Whether freerdp_convert_gdi_order_color() id defined])],, + [Whether freerdp_convert_gdi_order_color() is defined])],, + [#include ]) + + AC_CHECK_DECL([freerdp_color_convert_drawing_order_color_to_gdi_color], + [AC_DEFINE([HAVE_FREERDP_COLOR_CONVERT_DRAWING_ORDER_COLOR_TO_GDI_COLOR],, + [Whether freerdp_color_convert_drawing_order_color_to_gdi_color() is defined])],, [#include ]) fi @@ -684,6 +689,42 @@ then [Whether the legacy rdpBitmap API was found])]) fi +# +# FreeRDP: Decompression function variants +# + +# Check whether interleaved_decompress() can handle the palette +if test "x${have_freerdp}" = "xyes" +then + AC_MSG_CHECKING([whether interleaved_decompress() accepts an additional palette parameter]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include + + int main() { + BYTE* palette = NULL; + interleaved_decompress(NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, palette); + }]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE([INTERLEAVED_DECOMPRESS_TAKES_PALETTE],, + [Whether interleaved_decompress() accepts an additional palette parameter])], + [AC_MSG_RESULT([no])]) +fi + +# Check whether planar_decompress() will handle flipping +if test "x${have_freerdp}" = "xyes" +then + AC_MSG_CHECKING([whether planar_decompress() can flip]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include + + int main() { + BOOL* flip = TRUE; + planar_decompress(NULL, NULL, 0, NULL, 0, 0, 0, 0, 0, 0, flip); + }]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE([PLANAR_DECOMPRESS_CAN_FLIP],, + [Whether planar_decompress() can flip])], + [AC_MSG_RESULT([no])]) +fi + # # FreeRDP: rdpContext # diff --git a/src/protocols/rdp/rdp_bitmap.c b/src/protocols/rdp/rdp_bitmap.c index 66e1d482..ee64c3f7 100644 --- a/src/protocols/rdp/rdp_bitmap.c +++ b/src/protocols/rdp/rdp_bitmap.c @@ -210,24 +210,36 @@ void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* d #ifdef HAVE_RDPCONTEXT_CODECS rdpCodecs* codecs = context->codecs; - UINT32* palette = ((rdp_freerdp_context*) context)->palette; /* Decode as interleaved if less than 32 bits per pixel */ if (bpp < 32) { freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED); +#ifdef INTERLEAVED_DECOMPRESS_TAKES_PALETTE interleaved_decompress(codecs->interleaved, data, length, bpp, &(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height, - (BYTE*) palette); + (BYTE*) ((rdp_freerdp_context*) context)->palette); + bitmap->bpp = 32; +#else + interleaved_decompress(codecs->interleaved, data, length, bpp, + &(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height); + bitmap->bpp = bpp; +#endif } /* Otherwise, decode as planar */ else { freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR); +#ifdef PLANAR_DECOMPRESS_CAN_FLIP planar_decompress(codecs->planar, data, length, - &(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height, TRUE); + &(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height, + TRUE); + bitmap->bpp = 32; +#else + planar_decompress(codecs->planar, data, length, + &(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height); + bitmap->bpp = bpp; +#endif } - - bitmap->bpp = 32; #else bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); bitmap->bpp = bpp; diff --git a/src/protocols/rdp/rdp_color.c b/src/protocols/rdp/rdp_color.c index 5344a4a9..9828d3b1 100644 --- a/src/protocols/rdp/rdp_color.c +++ b/src/protocols/rdp/rdp_color.c @@ -43,6 +43,14 @@ UINT32 guac_rdp_convert_color(rdpContext* context, UINT32 color) { return freerdp_convert_gdi_order_color(color, guac_rdp_get_depth(context->instance), PIXEL_FORMAT_ARGB32, (BYTE*) palette); + +#elif defined(HAVE_FREERDP_COLOR_CONVERT_DRAWING_ORDER_COLOR_TO_GDI_COLOR) + CLRCONV* clrconv = ((rdp_freerdp_context*) context)->clrconv; + + /* Convert given color to ARGB32 */ + return freerdp_color_convert_drawing_order_color_to_gdi_color(color, + guac_rdp_get_depth(context->instance), clrconv); + #else CLRCONV* clrconv = ((rdp_freerdp_context*) context)->clrconv;