libfreerdp-codec: improve clear_decompress function parameters
This commit is contained in:
parent
c20c3abdf1
commit
dd36617093
@ -256,8 +256,7 @@ int xf_SurfaceCommand_RemoteFX(xfContext* xfc, RdpgfxClientContext* context, RDP
|
||||
int xf_SurfaceCommand_ClearCodec(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
int status;
|
||||
UINT32 DstSize = 0;
|
||||
BYTE* pDstData = NULL;
|
||||
BYTE* DstData = NULL;
|
||||
xfGfxSurface* surface;
|
||||
RECTANGLE_16 invalidRect;
|
||||
|
||||
@ -266,9 +265,10 @@ int xf_SurfaceCommand_ClearCodec(xfContext* xfc, RdpgfxClientContext* context, R
|
||||
if (!surface)
|
||||
return -1;
|
||||
|
||||
status = clear_decompress(xfc->clear, cmd->data, cmd->length, &pDstData, &DstSize);
|
||||
DstData = surface->data;
|
||||
|
||||
printf("xf_SurfaceCommand_ClearCodec: status: %d\n", status);
|
||||
status = clear_decompress(NULL, cmd->data, cmd->length, &DstData,
|
||||
PIXEL_FORMAT_XRGB32, surface->scanline, cmd->left, cmd->top, cmd->width, cmd->height);
|
||||
|
||||
/* fill with pink for now to distinguish from the rest */
|
||||
|
||||
|
@ -42,7 +42,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
FREERDP_API int clear_compress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize);
|
||||
FREERDP_API int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize);
|
||||
|
||||
FREERDP_API int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight);
|
||||
|
||||
FREERDP_API void clear_context_reset(CLEAR_CONTEXT* clear);
|
||||
|
||||
|
@ -25,9 +25,11 @@
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/bitstream.h>
|
||||
|
||||
#include <freerdp/codec/color.h>
|
||||
#include <freerdp/codec/clear.h>
|
||||
|
||||
int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize)
|
||||
int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize,
|
||||
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight)
|
||||
{
|
||||
int index;
|
||||
BYTE glyphFlags;
|
||||
@ -81,11 +83,13 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE*
|
||||
|
||||
if (residualByteCount > 0)
|
||||
{
|
||||
UINT32 color;
|
||||
BYTE blueValue;
|
||||
BYTE greenValue;
|
||||
BYTE redValue;
|
||||
UINT32 suboffset;
|
||||
BYTE* residualData;
|
||||
UINT32 pixelIndex = 0;
|
||||
BYTE runLengthFactor1 = 0;
|
||||
UINT16 runLengthFactor2 = 0;
|
||||
UINT32 runLengthFactor3 = 0;
|
||||
@ -105,6 +109,7 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE*
|
||||
blueValue = residualData[suboffset];
|
||||
greenValue = residualData[suboffset + 1];
|
||||
redValue = residualData[suboffset + 2];
|
||||
color = RGB32(redValue, greenValue, blueValue);
|
||||
suboffset += 3;
|
||||
|
||||
runLengthFactor1 = residualData[suboffset];
|
||||
@ -130,6 +135,17 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE*
|
||||
suboffset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
//freerdp_image_fill(*ppDstData, DstFormat, nDstStep,
|
||||
// nXDst + (pixelIndex % nWidth), nYDst + (pixelIndex / nWidth), nWidth, nHeight, color);
|
||||
|
||||
pixelIndex += runLengthFactor;
|
||||
}
|
||||
|
||||
if (pixelIndex != (nWidth * nHeight))
|
||||
{
|
||||
fprintf(stderr, "ClearCodec residual data unexpected pixel count: Actual: %d, Expected: %d\n",
|
||||
pixelIndex, (nWidth * nHeight));
|
||||
}
|
||||
|
||||
/* Decompress residual layer and write to output bitmap */
|
||||
|
Loading…
Reference in New Issue
Block a user