Api update.

This commit is contained in:
Armin Novak 2016-04-13 23:18:55 +02:00 committed by Armin Novak
parent ac8c72238d
commit b668b0d75e
6 changed files with 132 additions and 129 deletions

View File

@ -118,17 +118,17 @@ FREERDP_API BYTE* freerdp_bitmap_compress_planar(
UINT32 width, UINT32 height, UINT32 scanline,
BYTE* dstData, UINT32* pDstSize);
FREERDP_API BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT*
context);
FREERDP_API BOOL freerdp_bitmap_planar_context_reset(
BITMAP_PLANAR_CONTEXT* context, UINT32 width, UINT32 height);
FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(
DWORD flags, UINT32 maxWidth, UINT32 maxHeight);
FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT*
context);
DWORD flags, UINT32 width, UINT32 height);
FREERDP_API void freerdp_bitmap_planar_context_free(
BITMAP_PLANAR_CONTEXT* context);
FREERDP_API INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
const BYTE* pSrcData, UINT32 SrcSize,
BYTE** ppDstData, UINT32 DstFormat,
BYTE* pDstData, UINT32 DstFormat,
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, BOOL vFlip);

View File

@ -367,7 +367,7 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
if (!DstFormat)
return FALSE;
status = freerdp_image_copy(interleaved->TempBuffer, DstFormat, -1, 0, 0, nWidth, nHeight,
status = freerdp_image_copy(interleaved->TempBuffer, DstFormat, 0, 0, 0, nWidth, nHeight,
pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
s = Stream_New(pDstData, maxSize);

View File

@ -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_BGRA32, -1, 0, 0, NULL))
PIXEL_FORMAT_BGRA32, 0, 0, 0, NULL))
return FALSE;
return TRUE;

View File

@ -94,7 +94,7 @@ static int planar_decompress_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
UINT32 cRawBytes;
UINT32 nRunLength;
INT32 deltaValue;
UINT32 beg, end, inc;
INT32 beg, end, inc;
BYTE controlByte;
BYTE* currentScanline;
BYTE* previousScanline;
@ -278,7 +278,7 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
const BYTE* pSrcData, UINT32 SrcSize,
BYTE** ppDstData, UINT32 DstFormat,
BYTE* pDstData, UINT32 DstFormat,
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, BOOL vFlip)
{
@ -292,7 +292,6 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
UINT32 subWidth;
UINT32 subHeight;
UINT32 planeSize;
BYTE* pDstData;
UINT32 rleSizes[4];
UINT32 rawSizes[4];
UINT32 rawWidths[4];
@ -315,16 +314,11 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
srcp = pSrcData;
UncompressedSize = nWidth * nHeight * GetBytesPerPixel(DstFormat);
pDstData = *ppDstData;
if (!pDstData)
{
pDstData = (BYTE*) _aligned_malloc(UncompressedSize, 16);
if (!pDstData)
WLog_ERR(TAG, "XXX");
return -1;
*ppDstData = pDstData;
}
FormatHeader = *srcp++;
@ -490,7 +484,6 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
if (DstFormat != TempFormat)
{
pTempData = planar->pTempData;
nTempStep = planar->nTempStep;
}
if (alpha)
@ -1131,11 +1124,41 @@ BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context,
return dstData;
}
BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT* context)
BOOL freerdp_bitmap_planar_context_reset(
BITMAP_PLANAR_CONTEXT* context, UINT32 width, UINT32 height)
{
if (!context)
return FALSE;
context->maxWidth = width;
context->maxHeight = height;
context->maxPlaneSize = context->maxWidth * context->maxHeight;
context->nTempStep = context->maxWidth * 4;
context->planesBuffer = malloc(context->maxPlaneSize * 4);
context->pTempData = malloc(context->maxPlaneSize * 4);
context->deltaPlanesBuffer = malloc(context->maxPlaneSize * 4);
context->rlePlanesBuffer = malloc(context->maxPlaneSize * 4);
if (!context->planesBuffer || !context->pTempData ||
!context->deltaPlanesBuffer || !context->rlePlanesBuffer)
return FALSE;
context->planes[0] = &context->planesBuffer[context->maxPlaneSize * 0];
context->planes[1] = &context->planesBuffer[context->maxPlaneSize * 1];
context->planes[2] = &context->planesBuffer[context->maxPlaneSize * 2];
context->planes[3] = &context->planesBuffer[context->maxPlaneSize * 3];
context->deltaPlanes[0] = &context->deltaPlanesBuffer[context->maxPlaneSize *
0];
context->deltaPlanes[1] = &context->deltaPlanesBuffer[context->maxPlaneSize *
1];
context->deltaPlanes[2] = &context->deltaPlanesBuffer[context->maxPlaneSize *
2];
context->deltaPlanes[3] = &context->deltaPlanesBuffer[context->maxPlaneSize *
3];
return TRUE;
}
@ -1162,45 +1185,13 @@ BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(
if (context->ColorLossLevel)
context->AllowDynamicColorFidelity = TRUE;
context->maxWidth = maxWidth;
context->maxHeight = maxHeight;
context->maxPlaneSize = context->maxWidth * context->maxHeight;
context->planesBuffer = malloc(context->maxPlaneSize * 4);
context->nTempStep = maxWidth * 4;
context->pTempData = malloc(context->maxPlaneSize * 4);
if (!context->planesBuffer || !context->planesBuffer)
goto error;
context->planes[0] = &context->planesBuffer[context->maxPlaneSize * 0];
context->planes[1] = &context->planesBuffer[context->maxPlaneSize * 1];
context->planes[2] = &context->planesBuffer[context->maxPlaneSize * 2];
context->planes[3] = &context->planesBuffer[context->maxPlaneSize * 3];
context->deltaPlanesBuffer = malloc(context->maxPlaneSize * 4);
if (!context->deltaPlanesBuffer)
goto error;
context->deltaPlanes[0] = &context->deltaPlanesBuffer[context->maxPlaneSize *
0];
context->deltaPlanes[1] = &context->deltaPlanesBuffer[context->maxPlaneSize *
1];
context->deltaPlanes[2] = &context->deltaPlanesBuffer[context->maxPlaneSize *
2];
context->deltaPlanes[3] = &context->deltaPlanesBuffer[context->maxPlaneSize *
3];
context->rlePlanesBuffer = malloc(context->maxPlaneSize * 4);
if (!context->rlePlanesBuffer)
goto error;
if (!freerdp_bitmap_planar_context_reset(context, maxWidth, maxHeight))
{
freerdp_bitmap_planar_context_free(context);
return NULL;
}
return context;
error:
free(context->pTempData);
free(context->deltaPlanesBuffer);
free(context->planesBuffer);
free(context);
return NULL;
}
void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context)

View File

@ -165,7 +165,7 @@ BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
{
if (codecs->planar)
{
rc &= freerdp_bitmap_planar_context_reset(codecs->planar);
rc &= freerdp_bitmap_planar_context_reset(codecs->planar, width, height);
}
}

View File

@ -457,7 +457,7 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
surface->scanline, surface->width,
surface->height);
if (status < 0)
if (rc < 0)
{
WLog_WARN(TAG, "avc444_decompress failure: %d, ignoring update.", status);
return CHANNEL_RC_OK;
@ -506,7 +506,8 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_ALPHACODEC))
return ERROR_INTERNAL_ERROR;
WLog_DBG(TAG, "gdi_SurfaceCommand_Alpha: status: %d", status);
WLog_DBG(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %d", status);
/* fill with green for now to distinguish from the rest */
if (!freerdp_image_fill(surface->data, surface->format, surface->scanline,
cmd->left, cmd->top, cmd->width, cmd->height, 0x00FF00))
@ -553,9 +554,20 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
cmd->surfaceId,
surface->width, surface->height);
if (status < 0)
if (rc < 0)
{
WLog_ERR(TAG, "progressive_decompress failure: %d", status);
WLog_ERR(TAG, "progressive_create_surface_context failure: %d", rc);
return ERROR_INTERNAL_ERROR;
}
rc = progressive_decompress(surface->codecs->progressive, cmd->data,
cmd->length, surface->data, surface->format,
surface->scanline, cmd->left, cmd->top,
cmd->width, cmd->height, cmd->surfaceId);
if (rc < 0)
{
WLog_ERR(TAG, "progressive_decompress failure: %d", rc);
return ERROR_INTERNAL_ERROR;
}