Fixed GFX related issues.
This commit is contained in:
parent
99c418766c
commit
a6cef5cde7
@ -590,10 +590,10 @@ static UINT rdpgfx_recv_wire_to_surface_1_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
|
||||
cmd.contextId = 0;
|
||||
switch(pdu.pixelFormat)
|
||||
{
|
||||
case PIXEL_FORMAT_XRGB_8888:
|
||||
case GFX_PIXEL_FORMAT_XRGB_8888:
|
||||
cmd.format = PIXEL_FORMAT_BGRX32;
|
||||
break;
|
||||
case PIXEL_FORMAT_ARGB_8888:
|
||||
case GFX_PIXEL_FORMAT_ARGB_8888:
|
||||
cmd.format = PIXEL_FORMAT_BGRA32;
|
||||
break;
|
||||
default:
|
||||
|
@ -102,9 +102,8 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
xfGfxSurface* surface;
|
||||
UINT16* pSurfaceIds = NULL;
|
||||
rdpContext* ctx = (rdpContext*)context->custom;
|
||||
xfContext* xfc = (xfContext*) ctx;
|
||||
rdpGdi* gdi = ctx->instance->context->gdi;
|
||||
rdpGdi* gdi = (rdpGdi*)context->custom;
|
||||
xfContext* xfc = (xfContext*) gdi->context;
|
||||
|
||||
if (!gdi)
|
||||
return status;
|
||||
@ -197,8 +196,8 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
{
|
||||
size_t size;
|
||||
xfGfxSurface* surface;
|
||||
rdpContext* ctx = (rdpContext*)context->custom;
|
||||
xfContext* xfc = (xfContext*) ctx;
|
||||
rdpGdi* gdi = (rdpGdi*)context->custom;
|
||||
xfContext* xfc = (xfContext*) gdi->context;
|
||||
|
||||
surface = (xfGfxSurface*) calloc(1, sizeof(xfGfxSurface));
|
||||
|
||||
@ -225,10 +224,10 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
surface->gdi.height = (UINT32) createSurface->height;
|
||||
switch(createSurface->pixelFormat)
|
||||
{
|
||||
case PIXEL_FORMAT_ARGB_8888:
|
||||
case GFX_PIXEL_FORMAT_ARGB_8888:
|
||||
surface->gdi.format = PIXEL_FORMAT_BGRA32;
|
||||
break;
|
||||
case PIXEL_FORMAT_XRGB_8888:
|
||||
case GFX_PIXEL_FORMAT_XRGB_8888:
|
||||
surface->gdi.format = PIXEL_FORMAT_BGRX32;
|
||||
break;
|
||||
default:
|
||||
@ -237,7 +236,11 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
}
|
||||
|
||||
surface->gdi.scanline = surface->gdi.width * GetBytesPerPixel(surface->gdi.format);
|
||||
surface->gdi.scanline += (xfc->scanline_pad / 8) - (surface->gdi.scanline % (xfc->scanline_pad / 8));
|
||||
if (xfc->scanline_pad > 0)
|
||||
{
|
||||
surface->gdi.scanline += (xfc->scanline_pad / 8);
|
||||
surface->gdi.scanline -= (surface->gdi.scanline % (xfc->scanline_pad / 8));
|
||||
}
|
||||
|
||||
size = surface->gdi.scanline * surface->gdi.height;
|
||||
surface->gdi.data = (BYTE*) _aligned_malloc(size, 16);
|
||||
@ -260,7 +263,11 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
UINT32 bytes = GetBytesPerPixel(xfc->format);
|
||||
|
||||
surface->stageScanline = width * bytes;
|
||||
surface->stageScanline += (xfc->scanline_pad / 8) - (surface->stageScanline % (xfc->scanline_pad / 8));
|
||||
if (xfc->scanline_pad > 0)
|
||||
{
|
||||
surface->stageScanline += (xfc->scanline_pad / 8);
|
||||
surface->stageScanline -= (surface->stageScanline % (xfc->scanline_pad / 8));
|
||||
}
|
||||
|
||||
size = surface->stageScanline * surface->gdi.height;
|
||||
|
||||
@ -268,15 +275,17 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
|
||||
if (!surface->stage)
|
||||
{
|
||||
free(surface->gdi.data);
|
||||
_aligned_free(surface->gdi.data);
|
||||
free(surface);
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
}
|
||||
|
||||
ZeroMemory(surface->stage, size);
|
||||
|
||||
surface->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) surface->stage, surface->gdi.width, surface->gdi.height, xfc->scanline_pad, surface->gdi.scanline);
|
||||
surface->image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
|
||||
ZPixmap, 0, (char*) surface->stage,
|
||||
surface->gdi.width, surface->gdi.height,
|
||||
xfc->scanline_pad, surface->gdi.scanline);
|
||||
}
|
||||
|
||||
surface->gdi.outputMapped = FALSE;
|
||||
@ -325,9 +334,6 @@ void xf_graphics_pipeline_init(xfContext* xfc, RdpgfxClientContext* gfx)
|
||||
{
|
||||
rdpGdi* gdi = xfc->context.gdi;
|
||||
|
||||
xfc->gfx = gfx;
|
||||
gfx->custom = xfc->instance->context;
|
||||
|
||||
gdi_graphics_pipeline_init(gdi, gfx);
|
||||
|
||||
gfx->UpdateSurfaces = xf_UpdateSurfaces;
|
||||
|
@ -46,8 +46,8 @@ struct _RDPGFX_COLOR32
|
||||
};
|
||||
typedef struct _RDPGFX_COLOR32 RDPGFX_COLOR32;
|
||||
|
||||
#define PIXEL_FORMAT_XRGB_8888 0x20
|
||||
#define PIXEL_FORMAT_ARGB_8888 0x21
|
||||
#define GFX_PIXEL_FORMAT_XRGB_8888 0x20
|
||||
#define GFX_PIXEL_FORMAT_ARGB_8888 0x21
|
||||
|
||||
typedef BYTE RDPGFX_PIXELFORMAT;
|
||||
|
||||
|
@ -241,6 +241,11 @@ static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi,
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_REMOTEFX,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!rfx_process_message(surface->codecs->rfx, cmd->data, cmd->format,
|
||||
cmd->length,
|
||||
cmd->left, cmd->top,
|
||||
@ -278,7 +283,12 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
rc = clear_decompress(gdi->codecs->clear, cmd->data, cmd->length,
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_CLEARCODEC,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
rc = clear_decompress(surface->codecs->clear, cmd->data, cmd->length,
|
||||
cmd->width, cmd->height,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
@ -324,6 +334,11 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_PLANAR,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
DstData = surface->data;
|
||||
rc = planar_decompress(surface->codecs->planar, cmd->data, cmd->length,
|
||||
DstData, surface->format,
|
||||
@ -369,6 +384,11 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_AVC420,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
bs = (RDPGFX_AVC420_BITMAP_STREAM*) cmd->extra;
|
||||
|
||||
if (!bs)
|
||||
@ -425,6 +445,11 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_AVC444,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
bs = (RDPGFX_AVC444_BITMAP_STREAM*) cmd->extra;
|
||||
|
||||
if (!bs)
|
||||
@ -489,6 +514,11 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_ALPHACODEC,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
WLog_DBG(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %d", status);
|
||||
|
||||
/* fill with green for now to distinguish from the rest */
|
||||
@ -530,6 +560,11 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_PROGRESSIVE,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
rc = progressive_create_surface_context(surface->codecs->progressive,
|
||||
cmd->surfaceId,
|
||||
surface->width, surface->height);
|
||||
@ -671,11 +706,11 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
|
||||
|
||||
switch (createSurface->pixelFormat)
|
||||
{
|
||||
case PIXEL_FORMAT_ARGB_8888:
|
||||
case GFX_PIXEL_FORMAT_ARGB_8888:
|
||||
surface->format = PIXEL_FORMAT_BGRA32;
|
||||
break;
|
||||
|
||||
case PIXEL_FORMAT_XRGB_8888:
|
||||
case GFX_PIXEL_FORMAT_XRGB_8888:
|
||||
surface->format = PIXEL_FORMAT_BGRX32;
|
||||
break;
|
||||
|
||||
@ -759,7 +794,7 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context,
|
||||
a = solidFill->fillPixel.XA;
|
||||
color = GetColor(PIXEL_FORMAT_ARGB32, r, g, b, a);
|
||||
color = ConvertColor(color, PIXEL_FORMAT_ARGB32, surface->format,
|
||||
&gdi->palette);
|
||||
&gdi->palette);
|
||||
|
||||
for (index = 0; index < solidFill->fillRectCount; index++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user