From b668b0d75ea878f612e3fb804773fb469115a232 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 13 Apr 2016 23:18:55 +0200 Subject: [PATCH] Api update. --- include/freerdp/codec/planar.h | 12 +-- libfreerdp/codec/interleaved.c | 24 ++--- libfreerdp/codec/nsc.c | 2 +- libfreerdp/codec/planar.c | 187 ++++++++++++++++----------------- libfreerdp/core/codecs.c | 2 +- libfreerdp/gdi/gfx.c | 34 ++++-- 6 files changed, 132 insertions(+), 129 deletions(-) diff --git a/include/freerdp/codec/planar.h b/include/freerdp/codec/planar.h index 59c840bc6..ba0d6cd54 100644 --- a/include/freerdp/codec/planar.h +++ b/include/freerdp/codec/planar.h @@ -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); diff --git a/libfreerdp/codec/interleaved.c b/libfreerdp/codec/interleaved.c index 2051713a6..329987cf8 100644 --- a/libfreerdp/codec/interleaved.c +++ b/libfreerdp/codec/interleaved.c @@ -247,12 +247,12 @@ static INLINE UINT32 ExtractRunLength(UINT32 code, const BYTE* pbOrderHdr, UINT3 #include "include/bitmap.c" INT32 interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, - const BYTE* pSrcData, UINT32 SrcSize, - UINT32 bpp, - BYTE* pDstData, UINT32 DstFormat, - UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, - UINT32 nWidth, UINT32 nHeight, - const UINT32* palette) + const BYTE* pSrcData, UINT32 SrcSize, + UINT32 bpp, + BYTE* pDstData, UINT32 DstFormat, + UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, + UINT32 nWidth, UINT32 nHeight, + const UINT32* palette) { INT32 status; UINT32 scanline; @@ -309,12 +309,12 @@ INT32 interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, { case 24: RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer, - scanline, nWidth, nHeight); + scanline, nWidth, nHeight); break; case 16: case 15: RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer, - scanline, nWidth, nHeight); + scanline, nWidth, nHeight); break; case 8: RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer, @@ -325,8 +325,8 @@ INT32 interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, } status = freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst, - nWidth, nHeight, interleaved->TempBuffer, - SrcFormat, scanline, 0, 0, palette); + nWidth, nHeight, interleaved->TempBuffer, + SrcFormat, scanline, 0, 0, palette); return status; } @@ -367,8 +367,8 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved, if (!DstFormat) return FALSE; - status = freerdp_image_copy(interleaved->TempBuffer, DstFormat, -1, 0, 0, nWidth, nHeight, - pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette); + status = freerdp_image_copy(interleaved->TempBuffer, DstFormat, 0, 0, 0, nWidth, nHeight, + pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette); s = Stream_New(pDstData, maxSize); diff --git a/libfreerdp/codec/nsc.c b/libfreerdp/codec/nsc.c index 972251c54..487aaf299 100644 --- a/libfreerdp/codec/nsc.c +++ b/libfreerdp/codec/nsc.c @@ -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; diff --git a/libfreerdp/codec/planar.c b/libfreerdp/codec/planar.c index a59d098d4..46d328ab8 100644 --- a/libfreerdp/codec/planar.c +++ b/libfreerdp/codec/planar.c @@ -83,10 +83,10 @@ static int planar_skip_plane_rle(const BYTE* pSrcData, UINT32 SrcSize, } static int planar_decompress_plane_rle(const BYTE* pSrcData, UINT32 SrcSize, - BYTE* pDstData, INT32 nDstStep, - UINT32 nXDst, UINT32 nYDst, - UINT32 nWidth, UINT32 nHeight, - UINT32 nChannel, BOOL vFlip) + BYTE* pDstData, INT32 nDstStep, + UINT32 nXDst, UINT32 nYDst, + UINT32 nWidth, UINT32 nHeight, + UINT32 nChannel, BOOL vFlip) { UINT32 x, y; BYTE* dstp; @@ -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) - return -1; - - *ppDstData = pDstData; + WLog_ERR(TAG, "XXX"); + return -1; } FormatHeader = *srcp++; @@ -405,28 +399,28 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar, { planes[3] = srcp; rleSizes[3] = planar_skip_plane_rle(planes[3], SrcSize - (planes[3] - pSrcData), - rawWidths[3], rawHeights[3]); /* AlphaPlane */ + rawWidths[3], rawHeights[3]); /* AlphaPlane */ if (rleSizes[3] < 0) return -1; planes[0] = planes[3] + rleSizes[3]; rleSizes[0] = planar_skip_plane_rle(planes[0], SrcSize - (planes[0] - pSrcData), - rawWidths[0], rawHeights[0]); /* RedPlane */ + rawWidths[0], rawHeights[0]); /* RedPlane */ if (rleSizes[0] < 0) return -1; planes[1] = planes[0] + rleSizes[0]; rleSizes[1] = planar_skip_plane_rle(planes[1], SrcSize - (planes[1] - pSrcData), - rawWidths[1], rawHeights[1]); /* GreenPlane */ + rawWidths[1], rawHeights[1]); /* GreenPlane */ if (rleSizes[1] < 1) return -1; planes[2] = planes[1] + rleSizes[1]; rleSizes[2] = planar_skip_plane_rle(planes[2], SrcSize - (planes[2] - pSrcData), - rawWidths[2], rawHeights[2]); /* BluePlane */ + rawWidths[2], rawHeights[2]); /* BluePlane */ if (rleSizes[2] < 1) return -1; @@ -435,21 +429,21 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar, { planes[0] = srcp; rleSizes[0] = planar_skip_plane_rle(planes[0], SrcSize - (planes[0] - pSrcData), - rawWidths[0], rawHeights[0]); /* RedPlane */ + rawWidths[0], rawHeights[0]); /* RedPlane */ if (rleSizes[0] < 0) return -1; planes[1] = planes[0] + rleSizes[0]; rleSizes[1] = planar_skip_plane_rle(planes[1], SrcSize - (planes[1] - pSrcData), - rawWidths[1], rawHeights[1]); /* GreenPlane */ + rawWidths[1], rawHeights[1]); /* GreenPlane */ if (rleSizes[1] < 1) return -1; planes[2] = planes[1] + rleSizes[1]; rleSizes[2] = planar_skip_plane_rle(planes[2], SrcSize - (planes[2] - pSrcData), - rawWidths[2], rawHeights[2]); /* BluePlane */ + rawWidths[2], rawHeights[2]); /* BluePlane */ if (rleSizes[2] < 1) return -1; @@ -463,13 +457,13 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar, if (alpha) { planar_decompress_planes_raw(planes, pDstData, DstFormat, nDstStep, - nXDst, nYDst, nWidth, nHeight, alpha, vFlip); + nXDst, nYDst, nWidth, nHeight, alpha, vFlip); srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3]; } else /* NoAlpha */ { planar_decompress_planes_raw(planes, pDstData, DstFormat, nDstStep, - nXDst, nYDst, nWidth, nHeight, alpha, vFlip); + nXDst, nYDst, nWidth, nHeight, alpha, vFlip); srcp += rawSizes[0] + rawSizes[1] + rawSizes[2]; } @@ -490,36 +484,35 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar, if (DstFormat != TempFormat) { pTempData = planar->pTempData; - nTempStep = planar->nTempStep; } if (alpha) { status = planar_decompress_plane_rle(planes[3], rleSizes[3], pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3, - vFlip); /* AlphaPlane */ + vFlip); /* AlphaPlane */ status = planar_decompress_plane_rle(planes[0], rleSizes[0], pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2, - vFlip); /* RedPlane */ + vFlip); /* RedPlane */ status = planar_decompress_plane_rle(planes[1], rleSizes[1], pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1, - vFlip); /* GreenPlane */ + vFlip); /* GreenPlane */ status = planar_decompress_plane_rle(planes[2], rleSizes[2], pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0, - vFlip); /* BluePlane */ + vFlip); /* BluePlane */ srcp += rleSizes[0] + rleSizes[1] + rleSizes[2] + rleSizes[3]; } else /* NoAlpha */ { status = planar_decompress_plane_rle(planes[0], rleSizes[0], pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2, - vFlip); /* RedPlane */ + vFlip); /* RedPlane */ status = planar_decompress_plane_rle(planes[1], rleSizes[1], pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1, - vFlip); /* GreenPlane */ + vFlip); /* GreenPlane */ status = planar_decompress_plane_rle(planes[2], rleSizes[2], pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0, - vFlip); /* BluePlane */ + vFlip); /* BluePlane */ srcp += rleSizes[0] + rleSizes[1] + rleSizes[2]; } @@ -551,13 +544,13 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar, if (alpha) { planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep, - nXDst, nYDst, nWidth, nHeight, alpha, vFlip); + nXDst, nYDst, nWidth, nHeight, alpha, vFlip); srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3]; } else /* NoAlpha */ { planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep, - nXDst, nYDst, nWidth, nHeight, alpha, vFlip); + nXDst, nYDst, nWidth, nHeight, alpha, vFlip); srcp += rawSizes[0] + rawSizes[1] + rawSizes[2]; } @@ -569,30 +562,30 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar, if (alpha) { status = planar_decompress_plane_rle(planes[3], rleSizes[3], - pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3, - vFlip); /* AlphaPlane */ + pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3, + vFlip); /* AlphaPlane */ status = planar_decompress_plane_rle(planes[0], rleSizes[0], - pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2, - vFlip); /* LumaPlane */ + pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2, + vFlip); /* LumaPlane */ status = planar_decompress_plane_rle(planes[1], rleSizes[1], - pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1, - vFlip); /* OrangeChromaPlane */ + pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1, + vFlip); /* OrangeChromaPlane */ status = planar_decompress_plane_rle(planes[2], rleSizes[2], - pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0, - vFlip); /* GreenChromaPlane */ + pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0, + vFlip); /* GreenChromaPlane */ srcp += rleSizes[0] + rleSizes[1] + rleSizes[2] + rleSizes[3]; } else /* NoAlpha */ { status = planar_decompress_plane_rle(planes[0], rleSizes[0], - pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2, - vFlip); /* LumaPlane */ + pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2, + vFlip); /* LumaPlane */ status = planar_decompress_plane_rle(planes[1], rleSizes[1], - pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1, - vFlip); /* OrangeChromaPlane */ + pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1, + vFlip); /* OrangeChromaPlane */ status = planar_decompress_plane_rle(planes[2], rleSizes[2], - pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0, - vFlip); /* GreenChromaPlane */ + pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0, + vFlip); /* GreenChromaPlane */ srcp += rleSizes[0] + rleSizes[1] + rleSizes[2]; } } @@ -606,8 +599,8 @@ INT32 planar_decompress(BITMAP_PLANAR_CONTEXT* planar, } static BOOL freerdp_split_color_planes(const BYTE* data, UINT32 format, - UINT32 width, UINT32 height, - UINT32 scanline, BYTE** planes) + UINT32 width, UINT32 height, + UINT32 scanline, BYTE** planes) { INT32 i, j, k; UINT32* pixel; @@ -630,8 +623,8 @@ static BOOL freerdp_split_color_planes(const BYTE* data, UINT32 format, } static UINT32 freerdp_bitmap_planar_write_rle_bytes( - const BYTE* pInBuffer, UINT32 cRawBytes, UINT32 nRunLength, - BYTE* pOutBuffer, UINT32 outBufferSize) + const BYTE* pInBuffer, UINT32 cRawBytes, UINT32 nRunLength, + BYTE* pOutBuffer, UINT32 outBufferSize) { const BYTE* pInput; BYTE* pOutput; @@ -788,9 +781,9 @@ static UINT32 freerdp_bitmap_planar_encode_rle_bytes(const BYTE* pInBuffer, { pBytes = pInput - (cRawBytes + nRunLength + 1); nBytesWritten = freerdp_bitmap_planar_write_rle_bytes( - pBytes, cRawBytes, - nRunLength, pOutput, - outBufferSize); + pBytes, cRawBytes, + nRunLength, pOutput, + outBufferSize); nRunLength = 0; if (!nBytesWritten || (nBytesWritten > outBufferSize)) @@ -858,7 +851,7 @@ BYTE* freerdp_bitmap_planar_compress_plane_rle(const BYTE* inPlane, while (outBufferSize) { nBytesWritten = freerdp_bitmap_planar_encode_rle_bytes( - pInput, width, pOutput, outBufferSize); + pInput, width, pOutput, outBufferSize); if ((!nBytesWritten) || (nBytesWritten > outBufferSize)) return NULL; @@ -878,8 +871,8 @@ BYTE* freerdp_bitmap_planar_compress_plane_rle(const BYTE* inPlane, } static UINT32 freerdp_bitmap_planar_compress_planes_rle( - const BYTE** inPlanes, UINT32 width, UINT32 height, - BYTE* outPlanes, UINT32* dstSizes, BOOL skipAlpha) + const BYTE** inPlanes, UINT32 width, UINT32 height, + BYTE* outPlanes, UINT32* dstSizes, BOOL skipAlpha) { UINT32 outPlanesSize = width * height * 4; @@ -985,9 +978,9 @@ BOOL freerdp_bitmap_planar_delta_encode_planes(const BYTE** inPlanes, } BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context, - const BYTE* data, UINT32 format, - UINT32 width, UINT32 height, UINT32 scanline, - BYTE* dstData, UINT32* pDstSize) + const BYTE* data, UINT32 format, + UINT32 width, UINT32 height, UINT32 scanline, + BYTE* dstData, UINT32* pDstSize) { UINT32 size; BYTE* dstp; @@ -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) diff --git a/libfreerdp/core/codecs.c b/libfreerdp/core/codecs.c index 6902f5e11..629c1234f 100644 --- a/libfreerdp/core/codecs.c +++ b/libfreerdp/core/codecs.c @@ -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); } } diff --git a/libfreerdp/gdi/gfx.c b/libfreerdp/gdi/gfx.c index bffc8e5ad..481c59172 100644 --- a/libfreerdp/gdi/gfx.c +++ b/libfreerdp/gdi/gfx.c @@ -69,7 +69,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context, continue; if (!freerdp_client_codecs_reset(surface->codecs, FREERDP_CODEC_ALL, - surface->width, surface->height)) + surface->width, surface->height)) { free(pSurfaceIds); return ERROR_INTERNAL_ERROR; @@ -81,7 +81,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context, free(pSurfaceIds); if (!freerdp_client_codecs_reset(gdi->codecs, FREERDP_CODEC_ALL, - gdi->width, gdi->height)) + gdi->width, gdi->height)) return ERROR_INTERNAL_ERROR; gdi->graphicsReset = TRUE; @@ -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; @@ -466,15 +466,15 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context, for (i = 0; i < meta1->numRegionRects; i++) { region16_union_rect(&(surface->invalidRegion), - &(surface->invalidRegion), - &(meta1->regionRects[i])); + &(surface->invalidRegion), + &(meta1->regionRects[i])); } for (i = 0; i < meta2->numRegionRects; i++) { region16_union_rect(&(surface->invalidRegion), - &(surface->invalidRegion), - &(meta2->regionRects[i])); + &(surface->invalidRegion), + &(meta2->regionRects[i])); } if (!gdi->inGfxFrame) @@ -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; } @@ -667,7 +679,7 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context, } if (!freerdp_client_codecs_reset(surface->codecs, FREERDP_CODEC_ALL, - createSurface->width, createSurface->height)) + createSurface->width, createSurface->height)) { free(surface); return ERROR_INTERNAL_ERROR;