* Extract the run length of a compression order.
*/
static INLINE UINT32 ExtractRunLength(UINT32 code, const BYTE* pbOrderHdr,
- UINT32* advance)
+ UINT32* advance)
{
UINT32 runLength;
UINT32 ladvance;
#define DESTWRITEPIXEL(_buf, _pix) do { (_buf)[0] = (BYTE)(_pix); \
(_buf)[1] = (BYTE)((_pix) >> 8); (_buf)[2] = (BYTE)((_pix) >> 16); } while (0)
#define DESTREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8) | \
- ((_buf)[2] << 16)
+ ((_buf)[2] << 16)
#define SRCREADPIXEL(_pix, _buf) _pix = (_buf)[0] | ((_buf)[1] << 8) | \
- ((_buf)[2] << 16)
+ ((_buf)[2] << 16)
#define DESTNEXTPIXEL(_buf) _buf += 3
#define SRCNEXTPIXEL(_buf) _buf += 3
#define WRITEFGBGIMAGE WriteFgBgImage24to24
#include "include/bitmap.c"
BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
- const BYTE* pSrcData, UINT32 SrcSize,
- UINT32 nSrcWidth, UINT32 nSrcHeight,
- UINT32 bpp,
- BYTE* pDstData, UINT32 DstFormat,
- UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
- UINT32 nDstWidth, UINT32 nDstHeight,
- const gdiPalette* palette)
+ const BYTE* pSrcData, UINT32 SrcSize,
+ UINT32 nSrcWidth, UINT32 nSrcHeight,
+ UINT32 bpp,
+ BYTE* pDstData, UINT32 DstFormat,
+ UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
+ UINT32 nDstWidth, UINT32 nDstHeight,
+ const gdiPalette* palette)
{
UINT32 scanline;
UINT32 SrcFormat;
UINT32 BufferSize;
- UINT32 dstBitsPerPixel;
- UINT32 dstBytesPerPixel;
- dstBitsPerPixel = GetBitsPerPixel(DstFormat);
- dstBytesPerPixel = GetBytesPerPixel(DstFormat);
if (!interleaved)
return FALSE;
- if (nDstStep <= 0)
- nDstStep = nDstWidth * dstBytesPerPixel;
-
switch (bpp)
{
case 24:
if (BufferSize > interleaved->TempSize)
{
interleaved->TempBuffer = _aligned_realloc(
- interleaved->TempBuffer,
- BufferSize, 16);
+ interleaved->TempBuffer,
+ BufferSize, 16);
interleaved->TempSize = BufferSize;
}
{
case 24:
RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer,
- scanline, nSrcWidth, nSrcHeight);
+ scanline, nSrcWidth, nSrcHeight);
break;
case 16:
case 15:
RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer,
- scanline, nSrcWidth, nSrcHeight);
+ scanline, nSrcWidth, nSrcHeight);
break;
case 8:
RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer,
- scanline, nSrcWidth, nSrcHeight);
+ scanline, nSrcWidth, nSrcHeight);
break;
default:
}
return freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
- nDstWidth, nDstHeight, interleaved->TempBuffer,
- SrcFormat, scanline, 0, 0, palette);
+ nDstWidth, nDstHeight, interleaved->TempBuffer,
+ SrcFormat, scanline, 0, 0, palette);
}
BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
- BYTE* pDstData, UINT32* pDstSize,
- UINT32 nWidth, UINT32 nHeight,
- const BYTE* pSrcData, UINT32 SrcFormat,
- UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
- const gdiPalette* palette, UINT32 bpp)
+ BYTE* pDstData, UINT32* pDstSize,
+ UINT32 nWidth, UINT32 nHeight,
+ const BYTE* pSrcData, UINT32 SrcFormat,
+ UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
+ const gdiPalette* palette, UINT32 bpp)
{
int status;
wStream* s;
if ((nWidth > 64) || (nHeight > 64))
{
WLog_ERR(TAG,
- "interleaved_compress: width (%d) or height (%d) is greater than 64", nWidth,
- nHeight);
+ "interleaved_compress: width (%d) or height (%d) is greater than 64", nWidth,
+ nHeight);
return FALSE;
}
return FALSE;
status = freerdp_image_copy(interleaved->TempBuffer, DstFormat, 0, 0, 0, nWidth,
- nHeight,
- pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
+ nHeight,
+ pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
s = Stream_New(pDstData, maxSize);
if (!s)
return FALSE;
status = freerdp_bitmap_compress((char*) interleaved->TempBuffer, nWidth,
- nHeight,
- s, bpp, maxSize, nHeight - 1, interleaved->bts, 0);
+ nHeight,
+ s, bpp, maxSize, nHeight - 1, interleaved->bts, 0);
Stream_SealLength(s);
*pDstSize = (UINT32) Stream_Length(s);
Stream_Free(s, FALSE);
{
BITMAP_INTERLEAVED_CONTEXT* interleaved;
interleaved = (BITMAP_INTERLEAVED_CONTEXT*) calloc(1,
- sizeof(BITMAP_INTERLEAVED_CONTEXT));
+ sizeof(BITMAP_INTERLEAVED_CONTEXT));
if (interleaved)
{
/* Bitmap Class */
HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, UINT32 nWidth, UINT32 nHeight,
- UINT32 SrcFormat, BYTE* data)
+ UINT32 SrcFormat, BYTE* data)
{
UINT32 nSrcStep;
UINT32 nDstStep;
nSrcStep = nWidth * GetBytesPerPixel(SrcFormat);
if (!freerdp_image_copy(pDstData, gdi->dstFormat, nDstStep, 0, 0,
- nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, 0, 0,
- &gdi->palette))
+ nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, 0, 0,
+ &gdi->palette))
{
_aligned_free(pDstData);
return NULL;
if (!bitmap->data)
gdi_bitmap->bitmap = gdi_CreateCompatibleBitmap(
- gdi->hdc, bitmap->width,
- bitmap->height);
+ gdi->hdc, bitmap->width,
+ bitmap->height);
else
{
UINT32 format = bitmap->format;
gdi_bitmap->bitmap = gdi_create_bitmap(gdi, bitmap->width,
- bitmap->height,
- format, bitmap->data);
+ bitmap->height,
+ format, bitmap->data);
}
if (!gdi_bitmap->bitmap)
UINT32 width = bitmap->right - bitmap->left + 1;
UINT32 height = bitmap->bottom - bitmap->top + 1;
return gdi_BitBlt(context->gdi->primary->hdc,
- bitmap->left, bitmap->top,
- width, height, gdi_bitmap->hdc,
- 0, 0, GDI_SRCCOPY, &context->gdi->palette);
+ bitmap->left, bitmap->top,
+ width, height, gdi_bitmap->hdc,
+ 0, 0, GDI_SRCCOPY, &context->gdi->palette);
}
static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
- const BYTE* pSrcData, UINT32 width, UINT32 height,
- UINT32 bpp, UINT32 length, BOOL compressed,
- UINT32 codecId)
+ const BYTE* pSrcData, UINT32 DstWidth, UINT32 DstHeight,
+ UINT32 bpp, UINT32 length, BOOL compressed,
+ UINT32 codecId)
{
- UINT16 size;
UINT32 SrcSize = length;
UINT32 SrcFormat;
UINT32 bytesPerPixel;
- UINT32 DstWidth = width;
- UINT32 DstHeight = height;
rdpGdi* gdi = context->gdi;
- bytesPerPixel = (bpp + 7) / 8;
- size = width * height * GetBytesPerPixel(gdi->dstFormat);
- bitmap->data = (BYTE*) _aligned_malloc(size, 16);
-
- if (!bitmap->data)
- return FALSE;
bitmap->compressed = FALSE;
- bitmap->length = size;
bitmap->format = gdi->dstFormat;
+ bitmap->length = DstWidth * DstHeight * GetBytesPerPixel(bitmap->format);
+
+ bytesPerPixel = GetBytesPerPixel(bpp);
+ bitmap->data = (BYTE*) _aligned_malloc(bitmap->length, 16);
+
+ if (!bitmap->data)
+ return FALSE;
if (compressed)
{
if (bpp < 32)
{
if (!interleaved_decompress(context->codecs->interleaved,
- pSrcData, SrcSize,
- width, height,
- bpp,
- bitmap->data, bitmap->format,
- 0, 0, 0, DstWidth, DstHeight,
- &gdi->palette))
+ pSrcData, SrcSize,
+ DstWidth, DstHeight,
+ bpp,
+ bitmap->data, bitmap->format,
+ 0, 0, 0, DstWidth, DstHeight,
+ &gdi->palette))
return FALSE;
}
else
{
if (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,
- width, height,
- bitmap->data, bitmap->format, 0, 0, 0,
- width, height, TRUE))
+ DstWidth, DstHeight,
+ bitmap->data, bitmap->format, 0, 0, 0,
+ DstWidth, DstHeight, TRUE))
return FALSE;
}
}
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
if (!freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,
- DstWidth, DstHeight, pSrcData, SrcFormat,
- 0, 0, 0, &gdi->palette))
+ DstWidth, DstHeight, pSrcData, SrcFormat,
+ 0, 0, 0, &gdi->palette))
return FALSE;
}
}
static BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
- BOOL primary)
+ BOOL primary)
{
rdpGdi* gdi = context->gdi;
}
gdi_glyph->bitmap = gdi_CreateBitmap(glyph->cx, glyph->cy, PIXEL_FORMAT_MONO,
- data);
+ data);
if (!gdi_glyph->bitmap)
{
}
static BOOL gdi_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, UINT32 x,
- UINT32 y, UINT32 w, UINT32 h, UINT32 sx, UINT32 sy, BOOL fOpRedundant)
+ UINT32 y, UINT32 w, UINT32 h, UINT32 sx, UINT32 sy, BOOL fOpRedundant)
{
gdiGlyph* gdi_glyph;
rdpGdi* gdi;
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT)brush);
rc = gdi_BitBlt(gdi->drawing->hdc, x, y, w, h, gdi_glyph->hdc, sx, sy,
- GDI_GLYPH_ORDER, &context->gdi->palette);
+ GDI_GLYPH_ORDER, &context->gdi->palette);
gdi_DeleteObject((HGDIOBJECT)brush);
return rc;
}
static BOOL gdi_Glyph_BeginDraw(rdpContext* context, UINT32 x, UINT32 y,
- UINT32 width, UINT32 height, UINT32 bgcolor,
- UINT32 fgcolor, BOOL fOpRedundant)
+ UINT32 width, UINT32 height, UINT32 bgcolor,
+ UINT32 fgcolor, BOOL fOpRedundant)
{
rdpGdi* gdi;
}
static BOOL gdi_Glyph_EndDraw(rdpContext* context, UINT32 x, UINT32 y,
- UINT32 width, UINT32 height, UINT32 bgcolor, UINT32 fgcolor)
+ UINT32 width, UINT32 height, UINT32 bgcolor, UINT32 fgcolor)
{
rdpGdi* gdi;