Merge pull request #19 from glyptodon/freerdp-beta-compat

GUAC-994: Fix build against 1.2.0-beta1+android9.
This commit is contained in:
James Muehlner 2015-01-23 16:18:14 -08:00
commit 37037b6f8b
3 changed files with 67 additions and 6 deletions

View File

@ -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 <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>])
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 <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
#

View File

@ -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
}
#else
bitmap_decompress(data, bitmap->data, width, height, length, 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,
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;