mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #3545 from akallabeth/legacy_rfx_fixes
Fixed Windows 7 RFX issues.
This commit is contained in:
commit
5a5f091b7c
|
@ -970,96 +970,96 @@ static BOOL xf_gdi_surface_update_frame(xfContext* xfc, UINT16 tx, UINT16 ty,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static BOOL xf_gdi_surface_bits(rdpContext* context,
|
||||
const SURFACE_BITS_COMMAND* cmd)
|
||||
static BOOL xf_gdi_update_screen(xfContext* xfc,
|
||||
const SURFACE_BITS_COMMAND* cmd,
|
||||
const BYTE* pSrcData)
|
||||
{
|
||||
BOOL ret;
|
||||
XImage* image;
|
||||
BYTE* pSrcData;
|
||||
BYTE* pDstData;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
BOOL ret = TRUE;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
REGION16 invalidRegion;
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
switch (cmd->codecID)
|
||||
{
|
||||
case RDP_CODEC_ID_REMOTEFX:
|
||||
if (!rfx_process_message(context->codecs->rfx, cmd->bitmapData,
|
||||
PIXEL_FORMAT_XRGB32, cmd->bitmapDataLength,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
gdi->primary_buffer, gdi->dstFormat, gdi->stride,
|
||||
gdi->height, &invalidRegion))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to process RemoteFX message");
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
if (!xfc || !pSrcData)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
XRectangle rect;
|
||||
rect.x = cmd->destLeft;
|
||||
rect.y = cmd->destTop;
|
||||
rect.width = cmd->width;
|
||||
rect.height = cmd->height;
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetClipRectangles(xfc->display, xfc->gc, cmd->destLeft, cmd->destTop,
|
||||
&rect, 1, YXBanded);
|
||||
|
||||
/* Invalidate the updated region */
|
||||
if (!xf_gdi_surface_update_frame(xfc, rect.x, rect.y,
|
||||
rect.width, rect.height))
|
||||
ret = FALSE;
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
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, 0, 0, 0, cmd->width, cmd->height))
|
||||
{
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
pDstData = gdi->primary_buffer;
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
(char*) pSrcData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
|
||||
if (image)
|
||||
{
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width,
|
||||
cmd->height);
|
||||
}
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL xf_gdi_surface_bits(rdpContext* context,
|
||||
const SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
BYTE* pSrcData;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
BOOL ret = FALSE;
|
||||
DWORD format;
|
||||
DWORD stride;
|
||||
rdpGdi* gdi;
|
||||
|
||||
if (!context || !cmd || !context->gdi)
|
||||
return FALSE;
|
||||
|
||||
gdi = context->gdi;
|
||||
stride = cmd->width * GetBytesPerPixel(gdi->dstFormat);
|
||||
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,
|
||||
format, cmd->bitmapDataLength,
|
||||
0, 0,
|
||||
gdi->primary_buffer, gdi->dstFormat, stride,
|
||||
gdi->height, NULL))
|
||||
goto fail;
|
||||
|
||||
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, format, stride,
|
||||
0, 0, cmd->width, cmd->height))
|
||||
goto fail;
|
||||
|
||||
break;
|
||||
|
||||
case RDP_CODEC_ID_NONE:
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
pSrcData = cmd->bitmapData;
|
||||
pDstData = gdi->primary_buffer;
|
||||
freerdp_image_copy(pDstData, gdi->dstFormat, 0, 0, 0,
|
||||
format = PIXEL_FORMAT_BGRX32_VF;
|
||||
|
||||
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, stride,
|
||||
0, 0,
|
||||
cmd->width, cmd->height, pSrcData,
|
||||
PIXEL_FORMAT_BGRX32_VF, 0, 0, 0, &xfc->context.gdi->palette);
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width,
|
||||
cmd->height);
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
format, 0, 0, 0, &xfc->context.gdi->palette))
|
||||
goto fail;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
WLog_ERR(TAG, "Unsupported codecID %d", cmd->codecID);
|
||||
ret = TRUE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = xf_gdi_update_screen(xfc, cmd, gdi->primary_buffer);
|
||||
fail:
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -407,7 +407,7 @@ BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
|
|||
|
||||
if (!freerdp_image_copy(pDstData, DstFormat, nDstStride, nXDst, nYDst,
|
||||
width, height, context->BitmapData,
|
||||
PIXEL_FORMAT_BGRX32_VF, 0, 0, 0, NULL))
|
||||
PIXEL_FORMAT_BGRA32, 0, 0, 0, NULL))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -1178,14 +1178,17 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
|||
|
||||
for (j = 0; j < nbUpdateRects; j++)
|
||||
{
|
||||
UINT32 stride = 64 * GetBytesPerPixel(format);
|
||||
UINT32 nXDst = updateRects[j].left;
|
||||
UINT32 nYDst = updateRects[j].top;
|
||||
UINT32 nWidth = updateRects[j].right - updateRects[j].left;
|
||||
UINT32 nHeight = updateRects[j].bottom - updateRects[j].top;
|
||||
UINT32 nXSrc = nXDst - updateRect.left;
|
||||
UINT32 nYSrc = nYDst - updateRect.top;
|
||||
UINT32 nWidth = MIN(64, updateRects[j].right - updateRects[j].left);
|
||||
UINT32 nHeight = MIN(64, updateRects[j].bottom - updateRects[j].top);
|
||||
|
||||
if (!freerdp_image_copy(dst, dstFormat, dstStride,
|
||||
nXDst, nYDst, nWidth, nHeight,
|
||||
tile->data, format, 64 * GetBytesPerPixel(format), 0, 0, NULL))
|
||||
tile->data, format, stride, nXSrc, nYSrc, NULL))
|
||||
goto fail;
|
||||
|
||||
if (invalidRegion)
|
||||
|
|
|
@ -946,6 +946,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)
|
||||
|
@ -961,40 +962,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,
|
||||
PIXEL_FORMAT_BGRX32,
|
||||
format,
|
||||
cmd->bitmapDataLength,
|
||||
0, 0,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
gdi->primary_buffer, gdi->dstFormat,
|
||||
cmd->width * GetBytesPerPixel(gdi->dstFormat),
|
||||
cmd->height, NULL))
|
||||
gdi->stride, gdi->height, NULL))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to process RemoteFX message");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
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, gdi->stride, cmd->destLeft, cmd->destTop,
|
||||
format, gdi->stride, cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case RDP_CODEC_ID_NONE:
|
||||
{
|
||||
format = PIXEL_FORMAT_BGRX32_VF;
|
||||
|
||||
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,
|
||||
cmd->bitmapData, format, 0, 0, 0,
|
||||
&gdi->palette))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1002,7 +1005,8 @@ static BOOL gdi_surface_bits(rdpContext* context,
|
|||
break;
|
||||
}
|
||||
|
||||
if (!gdi_InvalidateRegion(gdi->primary->hdc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height))
|
||||
if (!gdi_InvalidateRegion(gdi->primary->hdc, cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to update invalid region");
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue