libfreerdp-codec: improve clear_decompress function parameters

This commit is contained in:
Marc-André Moreau 2014-06-25 18:39:28 -04:00
parent c20c3abdf1
commit dd36617093
3 changed files with 24 additions and 6 deletions

View File

@ -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 xf_SurfaceCommand_ClearCodec(xfContext* xfc, RdpgfxClientContext* context, RDPGFX_SURFACE_COMMAND* cmd)
{ {
int status; int status;
UINT32 DstSize = 0; BYTE* DstData = NULL;
BYTE* pDstData = NULL;
xfGfxSurface* surface; xfGfxSurface* surface;
RECTANGLE_16 invalidRect; RECTANGLE_16 invalidRect;
@ -266,9 +265,10 @@ int xf_SurfaceCommand_ClearCodec(xfContext* xfc, RdpgfxClientContext* context, R
if (!surface) if (!surface)
return -1; 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 */ /* fill with pink for now to distinguish from the rest */

View File

@ -42,7 +42,9 @@ extern "C" {
#endif #endif
FREERDP_API int clear_compress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize); 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); FREERDP_API void clear_context_reset(CLEAR_CONTEXT* clear);

View File

@ -25,9 +25,11 @@
#include <winpr/print.h> #include <winpr/print.h>
#include <winpr/bitstream.h> #include <winpr/bitstream.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/clear.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; int index;
BYTE glyphFlags; BYTE glyphFlags;
@ -81,11 +83,13 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE*
if (residualByteCount > 0) if (residualByteCount > 0)
{ {
UINT32 color;
BYTE blueValue; BYTE blueValue;
BYTE greenValue; BYTE greenValue;
BYTE redValue; BYTE redValue;
UINT32 suboffset; UINT32 suboffset;
BYTE* residualData; BYTE* residualData;
UINT32 pixelIndex = 0;
BYTE runLengthFactor1 = 0; BYTE runLengthFactor1 = 0;
UINT16 runLengthFactor2 = 0; UINT16 runLengthFactor2 = 0;
UINT32 runLengthFactor3 = 0; UINT32 runLengthFactor3 = 0;
@ -105,6 +109,7 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE*
blueValue = residualData[suboffset]; blueValue = residualData[suboffset];
greenValue = residualData[suboffset + 1]; greenValue = residualData[suboffset + 1];
redValue = residualData[suboffset + 2]; redValue = residualData[suboffset + 2];
color = RGB32(redValue, greenValue, blueValue);
suboffset += 3; suboffset += 3;
runLengthFactor1 = residualData[suboffset]; runLengthFactor1 = residualData[suboffset];
@ -130,6 +135,17 @@ int clear_decompress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcSize, BYTE*
suboffset += 4; 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 */ /* Decompress residual layer and write to output bitmap */