Fixed format flip and offsets for GDI.

This commit is contained in:
Armin Novak 2016-10-11 18:44:50 +02:00
parent 404ae7d83c
commit 8286fa4b96
3 changed files with 263 additions and 246 deletions

View File

@ -999,14 +999,17 @@ static BOOL xf_gdi_surface_bits(rdpContext* context,
BYTE* pSrcData;
xfContext* xfc = (xfContext*) context;
BOOL ret = FALSE;
DWORD format;
rdpGdi* gdi = context->gdi;
xf_lock_x11(xfc, FALSE);
switch (cmd->codecID)
{
case RDP_CODEC_ID_REMOTEFX:
format = PIXEL_FORMAT_BGRX32;
if (!rfx_process_message(context->codecs->rfx, cmd->bitmapData,
PIXEL_FORMAT_BGRX32, cmd->bitmapDataLength,
format, cmd->bitmapDataLength,
cmd->destLeft, cmd->destTop,
gdi->primary_buffer, gdi->dstFormat, gdi->stride,
gdi->height, NULL))
@ -1016,10 +1019,12 @@ static BOOL xf_gdi_surface_bits(rdpContext* context,
break;
case RDP_CODEC_ID_NSCODEC:
format = FREERDP_VFLIP_PIXEL_FORMAT(gdi->dstFormat);
if (!nsc_process_message(context->codecs->nsc, cmd->bpp, cmd->width,
cmd->height,
cmd->bitmapData, cmd->bitmapDataLength,
gdi->primary_buffer, gdi->dstFormat, 0, 0, 0, cmd->width, cmd->height))
cmd->height, cmd->bitmapData, cmd->bitmapDataLength,
gdi->primary_buffer, format, gdi->stride,
cmd->destLeft, cmd->destTop, cmd->width, cmd->height))
goto fail;
ret = xf_gdi_update_screen(xfc, cmd, gdi->primary_buffer);
@ -1027,10 +1032,12 @@ static BOOL xf_gdi_surface_bits(rdpContext* context,
case RDP_CODEC_ID_NONE:
pSrcData = cmd->bitmapData;
format = PIXEL_FORMAT_BGRX32_VF;
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, 0, 0, 0,
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
cmd->destLeft, cmd->destTop,
cmd->width, cmd->height, pSrcData,
PIXEL_FORMAT_BGRX32_VF, 0, 0, 0, &xfc->context.gdi->palette))
format, 0, 0, 0, &xfc->context.gdi->palette))
goto fail;
ret = xf_gdi_update_screen(xfc, cmd, gdi->primary_buffer);

View File

@ -45,6 +45,12 @@
#define FREERDP_PIXEL_FORMAT_FLIP_MASKED(_format) (_format & 0x3FFFFFFF)
#define FREERDP_VFLIP_PIXEL_FORMAT(format) \
FREERDP_PIXEL_FORMAT_FLIP_MASKED(format) | (FREERDP_PIXEL_FLIP_VERTICAL << 30)
#define FREERDP_HFLIP_PIXEL_FORMAT(format) \
FREERDP_PIXEL_FORMAT_FLIP_MASKED(format) | (FREERDP_PIXEL_FLIP_HORIZONTAL << 30)
/*** Design considerations
*
* The format naming scheme is based on byte position in memory.
@ -168,128 +174,128 @@ static const char* GetColorFormatName(UINT32 format)
{
switch (format)
{
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
return "PIXEL_FORMAT_ARGB32";
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
return "PIXEL_FORMAT_ARGB32";
case PIXEL_FORMAT_ARGB32_VF:
return "PIXEL_FORMAT_ARGB32_VF";
case PIXEL_FORMAT_ARGB32_VF:
return "PIXEL_FORMAT_ARGB32_VF";
case PIXEL_FORMAT_XRGB32:
return "PIXEL_FORMAT_XRGB32";
case PIXEL_FORMAT_XRGB32:
return "PIXEL_FORMAT_XRGB32";
case PIXEL_FORMAT_XRGB32_VF:
return "PIXEL_FORMAT_XRGB32_VF";
case PIXEL_FORMAT_XRGB32_VF:
return "PIXEL_FORMAT_XRGB32_VF";
case PIXEL_FORMAT_ABGR32:
return "PIXEL_FORMAT_ABGR32";
case PIXEL_FORMAT_ABGR32:
return "PIXEL_FORMAT_ABGR32";
case PIXEL_FORMAT_ABGR32_VF:
return "PIXEL_FORMAT_ABGR32_VF";
case PIXEL_FORMAT_ABGR32_VF:
return "PIXEL_FORMAT_ABGR32_VF";
case PIXEL_FORMAT_XBGR32:
return "PIXEL_FORMAT_XBGR32";
case PIXEL_FORMAT_XBGR32:
return "PIXEL_FORMAT_XBGR32";
case PIXEL_FORMAT_XBGR32_VF:
return "PIXEL_FORMAT_XBGR32_VF";
case PIXEL_FORMAT_XBGR32_VF:
return "PIXEL_FORMAT_XBGR32_VF";
case PIXEL_FORMAT_BGRA32:
return "PIXEL_FORMAT_BGRA32";
case PIXEL_FORMAT_BGRA32:
return "PIXEL_FORMAT_BGRA32";
case PIXEL_FORMAT_BGRA32_VF:
return "PIXEL_FORMAT_BGRA32_VF";
case PIXEL_FORMAT_BGRA32_VF:
return "PIXEL_FORMAT_BGRA32_VF";
case PIXEL_FORMAT_BGRX32:
return "PIXEL_FORMAT_BGRX32";
case PIXEL_FORMAT_BGRX32:
return "PIXEL_FORMAT_BGRX32";
case PIXEL_FORMAT_BGRX32_VF:
return "PIXEL_FORMAT_BGRX32_VF";
case PIXEL_FORMAT_BGRX32_VF:
return "PIXEL_FORMAT_BGRX32_VF";
case PIXEL_FORMAT_RGBA32:
return "PIXEL_FORMAT_RGBA32";
case PIXEL_FORMAT_RGBA32:
return "PIXEL_FORMAT_RGBA32";
case PIXEL_FORMAT_RGBA32_VF:
return "PIXEL_FORMAT_RGBA32_VF";
case PIXEL_FORMAT_RGBA32_VF:
return "PIXEL_FORMAT_RGBA32_VF";
case PIXEL_FORMAT_RGBX32:
return "PIXEL_FORMAT_RGBX32";
case PIXEL_FORMAT_RGBX32:
return "PIXEL_FORMAT_RGBX32";
case PIXEL_FORMAT_RGBX32_VF:
return "PIXEL_FORMAT_RGBX32_VF";
case PIXEL_FORMAT_RGBX32_VF:
return "PIXEL_FORMAT_RGBX32_VF";
/* 24bpp formats */
case PIXEL_FORMAT_RGB24:
return "PIXEL_FORMAT_RGB24";
case PIXEL_FORMAT_RGB24:
return "PIXEL_FORMAT_RGB24";
case PIXEL_FORMAT_RGB24_VF:
return "PIXEL_FORMAT_RGB24_VF";
case PIXEL_FORMAT_RGB24_VF:
return "PIXEL_FORMAT_RGB24_VF";
case PIXEL_FORMAT_BGR24:
return "PIXEL_FORMAT_BGR24";
case PIXEL_FORMAT_BGR24:
return "PIXEL_FORMAT_BGR24";
case PIXEL_FORMAT_BGR24_VF:
return "PIXEL_FORMAT_BGR24_VF";
case PIXEL_FORMAT_BGR24_VF:
return "PIXEL_FORMAT_BGR24_VF";
/* 16bpp formats */
case PIXEL_FORMAT_RGB16:
return "PIXEL_FORMAT_RGB16";
case PIXEL_FORMAT_RGB16:
return "PIXEL_FORMAT_RGB16";
case PIXEL_FORMAT_RGB16_VF:
return "PIXEL_FORMAT_RGB16_VF";
case PIXEL_FORMAT_RGB16_VF:
return "PIXEL_FORMAT_RGB16_VF";
case PIXEL_FORMAT_BGR16:
return "PIXEL_FORMAT_BGR16";
case PIXEL_FORMAT_BGR16:
return "PIXEL_FORMAT_BGR16";
case PIXEL_FORMAT_BGR16_VF:
return "PIXEL_FORMAT_BGR16_VF";
case PIXEL_FORMAT_BGR16_VF:
return "PIXEL_FORMAT_BGR16_VF";
case PIXEL_FORMAT_ARGB15:
return "PIXEL_FORMAT_ARGB15";
case PIXEL_FORMAT_ARGB15:
return "PIXEL_FORMAT_ARGB15";
case PIXEL_FORMAT_ARGB15_VF:
return "PIXEL_FORMAT_ARGB15_VF";
case PIXEL_FORMAT_ARGB15_VF:
return "PIXEL_FORMAT_ARGB15_VF";
case PIXEL_FORMAT_RGB15:
return "PIXEL_FORMAT_RGB15";
case PIXEL_FORMAT_RGB15:
return "PIXEL_FORMAT_RGB15";
case PIXEL_FORMAT_RGB15_VF:
return "PIXEL_FORMAT_ABGR15";
case PIXEL_FORMAT_RGB15_VF:
return "PIXEL_FORMAT_ABGR15";
case PIXEL_FORMAT_ABGR15:
return "";
case PIXEL_FORMAT_ABGR15:
return "";
case PIXEL_FORMAT_ABGR15_VF:
return "PIXEL_FORMAT_ABGR15_VF";
case PIXEL_FORMAT_ABGR15_VF:
return "PIXEL_FORMAT_ABGR15_VF";
case PIXEL_FORMAT_BGR15:
return "PIXEL_FORMAT_BGR15";
case PIXEL_FORMAT_BGR15:
return "PIXEL_FORMAT_BGR15";
case PIXEL_FORMAT_BGR15_VF:
return "PIXEL_FORMAT_BGR15_VF";
case PIXEL_FORMAT_BGR15_VF:
return "PIXEL_FORMAT_BGR15_VF";
/* 8bpp formats */
case PIXEL_FORMAT_RGB8:
return "PIXEL_FORMAT_RGB8";
case PIXEL_FORMAT_RGB8:
return "PIXEL_FORMAT_RGB8";
case PIXEL_FORMAT_RGB8_VF:
return "PIXEL_FORMAT_RGB8_VF";
case PIXEL_FORMAT_RGB8_VF:
return "PIXEL_FORMAT_RGB8_VF";
/* 4 bpp formats */
case PIXEL_FORMAT_A4:
return "PIXEL_FORMAT_A4";
case PIXEL_FORMAT_A4:
return "PIXEL_FORMAT_A4";
case PIXEL_FORMAT_A4_VF:
return "PIXEL_FORMAT_A4_VF";
case PIXEL_FORMAT_A4_VF:
return "PIXEL_FORMAT_A4_VF";
/* 1bpp formats */
case PIXEL_FORMAT_MONO:
return "PIXEL_FORMAT_MONO";
case PIXEL_FORMAT_MONO:
return "PIXEL_FORMAT_MONO";
case PIXEL_FORMAT_MONO_VF:
return "PIXEL_FORMAT_MONO_VF";
case PIXEL_FORMAT_MONO_VF:
return "PIXEL_FORMAT_MONO_VF";
default:
return "UNKNOWN";
default:
return "UNKNOWN";
}
}
@ -313,9 +319,9 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
switch (FREERDP_PIXEL_FORMAT_FLIP_MASKED(format))
{
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
if (_a)
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
if (_a)
*_a = color >> 24;
if (_r)
@ -327,10 +333,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_b)
*_b = color;
break;
break;
case PIXEL_FORMAT_XRGB32:
if (_r)
case PIXEL_FORMAT_XRGB32:
if (_r)
*_r = color >> 16;
if (_g)
@ -342,10 +348,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
case PIXEL_FORMAT_ABGR32:
if (_a)
case PIXEL_FORMAT_ABGR32:
if (_a)
*_a = color >> 24;
if (_b)
@ -357,10 +363,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_r)
*_r = color;
break;
break;
case PIXEL_FORMAT_XBGR32:
if (_b)
case PIXEL_FORMAT_XBGR32:
if (_b)
*_b = color >> 16;
if (_g)
@ -372,10 +378,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
case PIXEL_FORMAT_RGBA32:
if (_r)
case PIXEL_FORMAT_RGBA32:
if (_r)
*_r = color >> 24;
if (_g)
@ -387,10 +393,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = color;
break;
break;
case PIXEL_FORMAT_RGBX32:
if (_r)
case PIXEL_FORMAT_RGBX32:
if (_r)
*_r = color >> 24;
if (_g)
@ -402,10 +408,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
case PIXEL_FORMAT_BGRA32:
if (_b)
case PIXEL_FORMAT_BGRA32:
if (_b)
*_b = color >> 24;
if (_g)
@ -417,10 +423,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = color;
break;
break;
case PIXEL_FORMAT_BGRX32:
if (_b)
case PIXEL_FORMAT_BGRX32:
if (_b)
*_b = color >> 24;
if (_g)
@ -432,11 +438,11 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
/* 24bpp formats */
case PIXEL_FORMAT_RGB24:
if (_r)
case PIXEL_FORMAT_RGB24:
if (_r)
*_r = color >> 16;
if (_g)
@ -448,10 +454,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
case PIXEL_FORMAT_BGR24:
if (_b)
case PIXEL_FORMAT_BGR24:
if (_b)
*_b = color >> 16;
if (_g)
@ -463,11 +469,11 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
/* 16bpp formats */
case PIXEL_FORMAT_RGB16:
if (_r)
case PIXEL_FORMAT_RGB16:
if (_r)
*_r = ((color >> 11) & 0x1F) << 3;
if (_g)
@ -479,10 +485,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
case PIXEL_FORMAT_BGR16:
if (_b)
case PIXEL_FORMAT_BGR16:
if (_b)
*_b = ((color >> 11) & 0x1F) << 3;
if (_g)
@ -494,10 +500,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
case PIXEL_FORMAT_ARGB15:
if (_r)
case PIXEL_FORMAT_ARGB15:
if (_r)
*_r = ((color >> 10) & 0x1F) << 3;
if (_g)
@ -509,10 +515,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = color & 0x8000 ? 0xFF : 0x00;
break;
break;
case PIXEL_FORMAT_ABGR15:
if (_b)
case PIXEL_FORMAT_ABGR15:
if (_b)
*_b = ((color >> 10) & 0x1F) << 3;
if (_g)
@ -524,11 +530,11 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = color & 0x8000 ? 0xFF : 0x00;
break;
break;
/* 15bpp formats */
case PIXEL_FORMAT_RGB15:
if (_r)
case PIXEL_FORMAT_RGB15:
if (_r)
*_r = ((color >> 10) & 0x1F) << 3;
if (_g)
@ -540,10 +546,10 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
case PIXEL_FORMAT_BGR15:
if (_b)
case PIXEL_FORMAT_BGR15:
if (_b)
*_b = ((color >> 10) & 0x1F) << 3;
if (_g)
@ -555,21 +561,21 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = 0xFF;
break;
break;
/* 8bpp formats */
case PIXEL_FORMAT_RGB8:
if (color <= 0xFF)
case PIXEL_FORMAT_RGB8:
if (color <= 0xFF)
{
tmp = palette->palette[color];
SplitColor(tmp, palette->format, _r, _g, _b, _a, NULL);
}
break;
break;
/* 1bpp formats */
case PIXEL_FORMAT_MONO:
if (_r)
case PIXEL_FORMAT_MONO:
if (_r)
*_r = (color) ? 0xFF : 0x00;
if (_g)
@ -581,13 +587,13 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
if (_a)
*_a = (color) ? 0xFF : 0x00;
break;
break;
/* 4 bpp formats */
case PIXEL_FORMAT_A4:
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
break;
case PIXEL_FORMAT_A4:
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
break;
}
}
@ -613,75 +619,75 @@ static INLINE UINT32 GetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
switch (FREERDP_PIXEL_FORMAT_FLIP_MASKED(format))
{
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
return (_a << 24) | (_r << 16) | (_g << 8) | _b;
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
return (_a << 24) | (_r << 16) | (_g << 8) | _b;
case PIXEL_FORMAT_XRGB32:
return (_r << 16) | (_g << 8) | _b;
case PIXEL_FORMAT_XRGB32:
return (_r << 16) | (_g << 8) | _b;
case PIXEL_FORMAT_ABGR32:
return (_a << 24) | (_b << 16) | (_g << 8) | _r;
case PIXEL_FORMAT_ABGR32:
return (_a << 24) | (_b << 16) | (_g << 8) | _r;
case PIXEL_FORMAT_XBGR32:
return (_b << 16) | (_g << 8) | _r;
case PIXEL_FORMAT_XBGR32:
return (_b << 16) | (_g << 8) | _r;
case PIXEL_FORMAT_RGBA32:
return (_r << 24) | (_g << 16) | (_b << 8) | _a;
case PIXEL_FORMAT_RGBA32:
return (_r << 24) | (_g << 16) | (_b << 8) | _a;
case PIXEL_FORMAT_RGBX32:
return (_r << 24) | (_g << 16) | (_b << 8) | _a;
case PIXEL_FORMAT_RGBX32:
return (_r << 24) | (_g << 16) | (_b << 8) | _a;
case PIXEL_FORMAT_BGRA32:
return (_b << 24) | (_g << 16) | (_r << 8) | _a;
case PIXEL_FORMAT_BGRA32:
return (_b << 24) | (_g << 16) | (_r << 8) | _a;
case PIXEL_FORMAT_BGRX32:
return (_b << 24) | (_g << 16) | (_r << 8) | _a;
case PIXEL_FORMAT_BGRX32:
return (_b << 24) | (_g << 16) | (_r << 8) | _a;
/* 24bpp formats */
case PIXEL_FORMAT_RGB24:
return (_r << 16) | (_g << 8) | _b;
case PIXEL_FORMAT_RGB24:
return (_r << 16) | (_g << 8) | _b;
case PIXEL_FORMAT_BGR24:
return (_b << 16) | (_g << 8) | _r;
case PIXEL_FORMAT_BGR24:
return (_b << 16) | (_g << 8) | _r;
/* 16bpp formats */
case PIXEL_FORMAT_RGB16:
return (((_r >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
case PIXEL_FORMAT_RGB16:
return (((_r >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
_b >> 3) & 0x1F);
case PIXEL_FORMAT_BGR16:
return (((_b >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
case PIXEL_FORMAT_BGR16:
return (((_b >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
_r >> 3) & 0x1F);
case PIXEL_FORMAT_ARGB15:
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
case PIXEL_FORMAT_ARGB15:
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
_b >> 3) & 0x1F) | (_a ? 0x8000 : 0x0000);
case PIXEL_FORMAT_ABGR15:
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
case PIXEL_FORMAT_ABGR15:
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
_r >> 3) & 0x1F) | (_a ? 0x8000 : 0x0000);
/* 15bpp formats */
case PIXEL_FORMAT_RGB15:
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
case PIXEL_FORMAT_RGB15:
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
_b >> 3) & 0x1F);
case PIXEL_FORMAT_BGR15:
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
case PIXEL_FORMAT_BGR15:
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
_r >> 3) & 0x1F);
/* 8bpp formats */
case PIXEL_FORMAT_RGB8:
case PIXEL_FORMAT_RGB8:
/* 4 bpp formats */
case PIXEL_FORMAT_A4:
case PIXEL_FORMAT_A4:
/* 1bpp formats */
case PIXEL_FORMAT_MONO:
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
return 0;
case PIXEL_FORMAT_MONO:
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
return 0;
}
}
@ -728,37 +734,37 @@ static INLINE UINT32 ReadColor(const BYTE* src, UINT32 format)
switch (GetBitsPerPixel(format))
{
case 32:
color = ((UINT32)src[0] << 24) | ((UINT32)src[1] << 16) |
case 32:
color = ((UINT32)src[0] << 24) | ((UINT32)src[1] << 16) |
((UINT32)src[2] << 8) | src[3];
break;
break;
case 24:
color = ((UINT32)src[0] << 16) | ((UINT32)src[1] << 8) | src[2];
break;
case 24:
color = ((UINT32)src[0] << 16) | ((UINT32)src[1] << 8) | src[2];
break;
case 16:
color = ((UINT32)src[1] << 8) | src[0];
break;
case 16:
color = ((UINT32)src[1] << 8) | src[0];
break;
case 15:
color = ((UINT32)src[1] << 8) | src[0];
case 15:
color = ((UINT32)src[1] << 8) | src[0];
if (!ColorHasAlpha(format))
color = color & 0x7FFF;
break;
break;
case 8:
case 4:
case 1:
color = *src;
break;
case 8:
case 4:
case 1:
color = *src;
break;
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
color = 0;
break;
break;
}
return color;
@ -778,39 +784,39 @@ static INLINE BOOL WriteColor(BYTE* dst, UINT32 format, UINT32 color)
{
switch (GetBitsPerPixel(format))
{
case 32:
dst[0] = color >> 24;
case 32:
dst[0] = color >> 24;
dst[1] = color >> 16;
dst[2] = color >> 8;
dst[3] = color;
break;
break;
case 24:
dst[0] = color >> 16;
case 24:
dst[0] = color >> 16;
dst[1] = color >> 8;
dst[2] = color;
break;
break;
case 16:
dst[1] = color >> 8;
case 16:
dst[1] = color >> 8;
dst[0] = color;
break;
break;
case 15:
if (!ColorHasAlpha(format))
case 15:
if (!ColorHasAlpha(format))
color = color & 0x7FFF;
dst[1] = color >> 8;
dst[0] = color;
break;
break;
case 8:
dst[0] = color;
break;
case 8:
dst[0] = color;
break;
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
return FALSE;
default:
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
return FALSE;
}
return TRUE;

View File

@ -1005,6 +1005,7 @@ BOOL gdi_surface_frame_marker(rdpContext* context,
static BOOL gdi_surface_bits(rdpContext* context,
const SURFACE_BITS_COMMAND* cmd)
{
DWORD format;
rdpGdi* gdi;
if (!context || !cmd)
@ -1020,39 +1021,42 @@ static BOOL gdi_surface_bits(rdpContext* context,
switch (cmd->codecID)
{
case RDP_CODEC_ID_REMOTEFX:
format = PIXEL_FORMAT_BGRX32;
if (!rfx_process_message(context->codecs->rfx, cmd->bitmapData,
format,
cmd->bitmapDataLength,
cmd->destLeft, cmd->destTop,
gdi->primary_buffer, gdi->dstFormat,
gdi->stride, gdi->height, NULL))
{
if (!rfx_process_message(context->codecs->rfx, cmd->bitmapData,
PIXEL_FORMAT_BGRX32,
cmd->bitmapDataLength,
cmd->destLeft, cmd->destTop,
gdi->primary_buffer, gdi->dstFormat,
gdi->stride, gdi->height, NULL))
{
WLog_ERR(TAG, "Failed to process RemoteFX message");
return FALSE;
}
WLog_ERR(TAG, "Failed to process RemoteFX message");
return FALSE;
}
break;
case RDP_CODEC_ID_NSCODEC:
{
if (!nsc_process_message(context->codecs->nsc, cmd->bpp, cmd->width,
cmd->height, cmd->bitmapData,
cmd->bitmapDataLength, gdi->primary_buffer,
gdi->dstFormat, gdi->stride, cmd->destLeft, cmd->destTop,
cmd->width, cmd->height))
return FALSE;
}
format = FREERDP_VFLIP_PIXEL_FORMAT(gdi->dstFormat);
if (!nsc_process_message(context->codecs->nsc, cmd->bpp, cmd->width,
cmd->height, cmd->bitmapData,
cmd->bitmapDataLength, gdi->primary_buffer,
format, gdi->stride, cmd->destLeft, cmd->destTop,
cmd->width, cmd->height))
return FALSE;
break;
case RDP_CODEC_ID_NONE:
{
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
cmd->destLeft, cmd->destTop, cmd->width, cmd->height,
cmd->bitmapData, PIXEL_FORMAT_XRGB32_VF, 0, 0, 0,
&gdi->palette))
return FALSE;
}
format = PIXEL_FORMAT_XRGB32_VF;
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
cmd->destLeft, cmd->destTop, cmd->width, cmd->height,
cmd->bitmapData, format, 0, 0, 0,
&gdi->palette))
return FALSE;
break;
default: