GUAC-994: Add support for interleaved_decompress() and planar_decompress() variants in FreeRDP 1.2.0-beta1+android9. Use working color conversion function (old one is present but will not work in 1.2.0).

This commit is contained in:
Michael Jumper 2015-01-23 15:08:00 -08:00
parent 1588248d14
commit 959a7a202d
3 changed files with 67 additions and 6 deletions

View File

@ -429,7 +429,12 @@ if test "x${have_freerdp}" = "xyes"
then then
AC_CHECK_DECL([freerdp_convert_gdi_order_color], AC_CHECK_DECL([freerdp_convert_gdi_order_color],
[AC_DEFINE([HAVE_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 <freerdp/codec/color.h>])
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 <freerdp/codec/color.h>]) [#include <freerdp/codec/color.h>])
fi fi
@ -684,6 +689,42 @@ then
[Whether the legacy rdpBitmap API was found])]) [Whether the legacy rdpBitmap API was found])])
fi 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 <freerdp/codec/interleaved.h>
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 <freerdp/codec/planar.h>
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 # FreeRDP: rdpContext
# #

View File

@ -210,24 +210,36 @@ void guac_rdp_bitmap_decompress(rdpContext* context, rdpBitmap* bitmap, UINT8* d
#ifdef HAVE_RDPCONTEXT_CODECS #ifdef HAVE_RDPCONTEXT_CODECS
rdpCodecs* codecs = context->codecs; rdpCodecs* codecs = context->codecs;
UINT32* palette = ((rdp_freerdp_context*) context)->palette;
/* Decode as interleaved if less than 32 bits per pixel */ /* Decode as interleaved if less than 32 bits per pixel */
if (bpp < 32) { if (bpp < 32) {
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED); freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
#ifdef INTERLEAVED_DECOMPRESS_TAKES_PALETTE
interleaved_decompress(codecs->interleaved, data, length, bpp, interleaved_decompress(codecs->interleaved, data, length, bpp,
&(bitmap->data), PIXEL_FORMAT_XRGB32, -1, 0, 0, width, height, &(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 */ /* Otherwise, decode as planar */
else { else {
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR); freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR);
#ifdef PLANAR_DECOMPRESS_CAN_FLIP
planar_decompress(codecs->planar, data, length, 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 #else
bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp); bitmap_decompress(data, bitmap->data, width, height, length, bpp, bpp);
bitmap->bpp = bpp; bitmap->bpp = bpp;

View File

@ -43,6 +43,14 @@ UINT32 guac_rdp_convert_color(rdpContext* context, UINT32 color) {
return freerdp_convert_gdi_order_color(color, return freerdp_convert_gdi_order_color(color,
guac_rdp_get_depth(context->instance), PIXEL_FORMAT_ARGB32, guac_rdp_get_depth(context->instance), PIXEL_FORMAT_ARGB32,
(BYTE*) palette); (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 #else
CLRCONV* clrconv = ((rdp_freerdp_context*) context)->clrconv; CLRCONV* clrconv = ((rdp_freerdp_context*) context)->clrconv;