mirror of https://github.com/FreeRDP/FreeRDP
Api update.
This commit is contained in:
parent
ac8c72238d
commit
b668b0d75e
|
@ -118,17 +118,17 @@ FREERDP_API BYTE* freerdp_bitmap_compress_planar(
|
||||||
UINT32 width, UINT32 height, UINT32 scanline,
|
UINT32 width, UINT32 height, UINT32 scanline,
|
||||||
BYTE* dstData, UINT32* pDstSize);
|
BYTE* dstData, UINT32* pDstSize);
|
||||||
|
|
||||||
FREERDP_API BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT*
|
FREERDP_API BOOL freerdp_bitmap_planar_context_reset(
|
||||||
context);
|
BITMAP_PLANAR_CONTEXT* context, UINT32 width, UINT32 height);
|
||||||
|
|
||||||
FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(
|
FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(
|
||||||
DWORD flags, UINT32 maxWidth, UINT32 maxHeight);
|
DWORD flags, UINT32 width, UINT32 height);
|
||||||
FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT*
|
FREERDP_API void freerdp_bitmap_planar_context_free(
|
||||||
context);
|
BITMAP_PLANAR_CONTEXT* context);
|
||||||
|
|
||||||
FREERDP_API INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
FREERDP_API INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
||||||
const BYTE* pSrcData, UINT32 SrcSize,
|
const BYTE* pSrcData, UINT32 SrcSize,
|
||||||
BYTE** ppDstData, UINT32 DstFormat,
|
BYTE* pDstData, UINT32 DstFormat,
|
||||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||||
UINT32 nWidth, UINT32 nHeight, BOOL vFlip);
|
UINT32 nWidth, UINT32 nHeight, BOOL vFlip);
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
||||||
if (!DstFormat)
|
if (!DstFormat)
|
||||||
return FALSE;
|
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);
|
pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
|
||||||
|
|
||||||
s = Stream_New(pDstData, maxSize);
|
s = Stream_New(pDstData, maxSize);
|
||||||
|
|
|
@ -407,7 +407,7 @@ BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
|
||||||
|
|
||||||
if (!freerdp_image_copy(pDstData, DstFormat, nDstStride, nXDst, nYDst,
|
if (!freerdp_image_copy(pDstData, DstFormat, nDstStride, nXDst, nYDst,
|
||||||
width, height, context->BitmapData,
|
width, height, context->BitmapData,
|
||||||
PIXEL_FORMAT_BGRA32, -1, 0, 0, NULL))
|
PIXEL_FORMAT_BGRA32, 0, 0, 0, NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -94,7 +94,7 @@ static int planar_decompress_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
|
||||||
UINT32 cRawBytes;
|
UINT32 cRawBytes;
|
||||||
UINT32 nRunLength;
|
UINT32 nRunLength;
|
||||||
INT32 deltaValue;
|
INT32 deltaValue;
|
||||||
UINT32 beg, end, inc;
|
INT32 beg, end, inc;
|
||||||
BYTE controlByte;
|
BYTE controlByte;
|
||||||
BYTE* currentScanline;
|
BYTE* currentScanline;
|
||||||
BYTE* previousScanline;
|
BYTE* previousScanline;
|
||||||
|
@ -278,7 +278,7 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
|
||||||
|
|
||||||
INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
||||||
const BYTE* pSrcData, UINT32 SrcSize,
|
const BYTE* pSrcData, UINT32 SrcSize,
|
||||||
BYTE** ppDstData, UINT32 DstFormat,
|
BYTE* pDstData, UINT32 DstFormat,
|
||||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||||
UINT32 nWidth, UINT32 nHeight, BOOL vFlip)
|
UINT32 nWidth, UINT32 nHeight, BOOL vFlip)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +292,6 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
||||||
UINT32 subWidth;
|
UINT32 subWidth;
|
||||||
UINT32 subHeight;
|
UINT32 subHeight;
|
||||||
UINT32 planeSize;
|
UINT32 planeSize;
|
||||||
BYTE* pDstData;
|
|
||||||
UINT32 rleSizes[4];
|
UINT32 rleSizes[4];
|
||||||
UINT32 rawSizes[4];
|
UINT32 rawSizes[4];
|
||||||
UINT32 rawWidths[4];
|
UINT32 rawWidths[4];
|
||||||
|
@ -315,16 +314,11 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
||||||
|
|
||||||
srcp = pSrcData;
|
srcp = pSrcData;
|
||||||
UncompressedSize = nWidth * nHeight * GetBytesPerPixel(DstFormat);
|
UncompressedSize = nWidth * nHeight * GetBytesPerPixel(DstFormat);
|
||||||
pDstData = *ppDstData;
|
|
||||||
|
|
||||||
if (!pDstData)
|
if (!pDstData)
|
||||||
{
|
{
|
||||||
pDstData = (BYTE*) _aligned_malloc(UncompressedSize, 16);
|
WLog_ERR(TAG, "XXX");
|
||||||
|
|
||||||
if (!pDstData)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
*ppDstData = pDstData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormatHeader = *srcp++;
|
FormatHeader = *srcp++;
|
||||||
|
@ -490,7 +484,6 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
||||||
if (DstFormat != TempFormat)
|
if (DstFormat != TempFormat)
|
||||||
{
|
{
|
||||||
pTempData = planar->pTempData;
|
pTempData = planar->pTempData;
|
||||||
nTempStep = planar->nTempStep;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alpha)
|
if (alpha)
|
||||||
|
@ -1131,11 +1124,41 @@ BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context,
|
||||||
return dstData;
|
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)
|
if (!context)
|
||||||
return FALSE;
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1162,45 +1185,13 @@ BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(
|
||||||
if (context->ColorLossLevel)
|
if (context->ColorLossLevel)
|
||||||
context->AllowDynamicColorFidelity = TRUE;
|
context->AllowDynamicColorFidelity = TRUE;
|
||||||
|
|
||||||
context->maxWidth = maxWidth;
|
if (!freerdp_bitmap_planar_context_reset(context, maxWidth, maxHeight))
|
||||||
context->maxHeight = maxHeight;
|
{
|
||||||
context->maxPlaneSize = context->maxWidth * context->maxHeight;
|
freerdp_bitmap_planar_context_free(context);
|
||||||
context->planesBuffer = malloc(context->maxPlaneSize * 4);
|
return NULL;
|
||||||
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;
|
|
||||||
|
|
||||||
return context;
|
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)
|
void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context)
|
||||||
|
|
|
@ -165,7 +165,7 @@ BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
|
||||||
{
|
{
|
||||||
if (codecs->planar)
|
if (codecs->planar)
|
||||||
{
|
{
|
||||||
rc &= freerdp_bitmap_planar_context_reset(codecs->planar);
|
rc &= freerdp_bitmap_planar_context_reset(codecs->planar, width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -457,7 +457,7 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||||
surface->scanline, surface->width,
|
surface->scanline, surface->width,
|
||||||
surface->height);
|
surface->height);
|
||||||
|
|
||||||
if (status < 0)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
WLog_WARN(TAG, "avc444_decompress failure: %d, ignoring update.", status);
|
WLog_WARN(TAG, "avc444_decompress failure: %d, ignoring update.", status);
|
||||||
return CHANNEL_RC_OK;
|
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))
|
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_ALPHACODEC))
|
||||||
return ERROR_INTERNAL_ERROR;
|
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 */
|
/* fill with green for now to distinguish from the rest */
|
||||||
if (!freerdp_image_fill(surface->data, surface->format, surface->scanline,
|
if (!freerdp_image_fill(surface->data, surface->format, surface->scanline,
|
||||||
cmd->left, cmd->top, cmd->width, cmd->height, 0x00FF00))
|
cmd->left, cmd->top, cmd->width, cmd->height, 0x00FF00))
|
||||||
|
@ -553,9 +554,20 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
|
||||||
cmd->surfaceId,
|
cmd->surfaceId,
|
||||||
surface->width, surface->height);
|
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;
|
return ERROR_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue