Fixed various issues with freerdp_bitmap_compress and interleaved_compress
This commit is contained in:
parent
c0c1d064be
commit
9e2c203771
@ -32,8 +32,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FREERDP_API int freerdp_bitmap_compress(const char* in_data, int width, int height,
|
FREERDP_API SSIZE_T freerdp_bitmap_compress(const void* in_data, UINT32 width, UINT32 height,
|
||||||
wStream* s, int bpp, int byte_limit, int start_line, wStream* temp_s, int e);
|
wStream* s, UINT32 bpp, UINT32 byte_limit, UINT32 start_line, wStream* temp_s, UINT32 e);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -381,11 +381,17 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
|||||||
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||||
const gdiPalette* palette, UINT32 bpp)
|
const gdiPalette* palette, UINT32 bpp)
|
||||||
{
|
{
|
||||||
int status;
|
BOOL status;
|
||||||
wStream* s;
|
wStream* s;
|
||||||
UINT32 DstFormat = 0;
|
UINT32 DstFormat = 0;
|
||||||
const size_t maxSize = 64 * 64 * 4;
|
const size_t maxSize = 64 * 64 * 4;
|
||||||
|
|
||||||
|
if (!interleaved || !pDstData || !pSrcData)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if ((nWidth == 0) || (nHeight == 0))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (nWidth % 4)
|
if (nWidth % 4)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "interleaved_compress: width is not a multiple of 4");
|
WLog_ERR(TAG, "interleaved_compress: width is not a multiple of 4");
|
||||||
@ -400,31 +406,43 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bpp == 24)
|
switch (bpp)
|
||||||
DstFormat = PIXEL_FORMAT_BGRX32;
|
{
|
||||||
else if (bpp == 16)
|
case 24:
|
||||||
DstFormat = PIXEL_FORMAT_RGB16;
|
DstFormat = PIXEL_FORMAT_BGRX32;
|
||||||
else if (bpp == 15)
|
break;
|
||||||
DstFormat = PIXEL_FORMAT_RGB15;
|
|
||||||
else if (bpp == 8)
|
|
||||||
DstFormat = PIXEL_FORMAT_RGB8;
|
|
||||||
|
|
||||||
if (!DstFormat)
|
case 16:
|
||||||
return FALSE;
|
DstFormat = PIXEL_FORMAT_RGB16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
DstFormat = PIXEL_FORMAT_RGB15;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!freerdp_image_copy(interleaved->TempBuffer, DstFormat, 0, 0, 0, nWidth,
|
if (!freerdp_image_copy(interleaved->TempBuffer, DstFormat, 0, 0, 0, nWidth,
|
||||||
nHeight,
|
nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc,
|
||||||
pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
|
palette, FREERDP_FLIP_NONE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
s = Stream_New(pDstData, maxSize);
|
s = Stream_New(pDstData, *pDstSize);
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
status = freerdp_bitmap_compress((char*) interleaved->TempBuffer, nWidth,
|
Stream_SetPosition(interleaved->bts, 0);
|
||||||
nHeight,
|
|
||||||
s, bpp, maxSize, nHeight - 1, interleaved->bts, 0);
|
if (freerdp_bitmap_compress(interleaved->TempBuffer, nWidth, nHeight,
|
||||||
|
s, bpp, maxSize, nHeight - 1,
|
||||||
|
interleaved->bts, 0) < 0)
|
||||||
|
status = FALSE;
|
||||||
|
else
|
||||||
|
status = TRUE;
|
||||||
|
|
||||||
Stream_SealLength(s);
|
Stream_SealLength(s);
|
||||||
*pDstSize = (UINT32) Stream_Length(s);
|
*pDstSize = (UINT32) Stream_Length(s);
|
||||||
Stream_Free(s, FALSE);
|
Stream_Free(s, FALSE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user