Merge pull request #3554 from akallabeth/color_refactor

Replaced _VF formats with copy flags.
This commit is contained in:
Martin Fleisz 2016-10-19 13:31:54 +02:00 committed by GitHub
commit f2abcaabc0
25 changed files with 395 additions and 720 deletions

View File

@ -971,7 +971,7 @@ static jboolean JNICALL jni_freerdp_update_graphics(
{
rc = freerdp_image_copy(pixels, DstFormat, info.stride, x, y, width, height,
gdi->primary_buffer, gdi->dstFormat, gdi->stride, x, y,
&gdi->palette);
&gdi->palette, FREERDP_FLIP_NONE);
}
if ((ret = AndroidBitmap_unlockPixels(env, bitmap)) < 0)

View File

@ -1032,12 +1032,12 @@ BOOL mf_Pointer_New(rdpContext* context, rdpPointer* pointer)
mrdpCursor->cursor_data = cursor_data;
format = PIXEL_FORMAT_RGBA32;
if (freerdp_image_copy_from_pointer_data(
if (!freerdp_image_copy_from_pointer_data(
cursor_data, format,
0, 0, 0, pointer->width, pointer->height,
pointer->xorMaskData, pointer->lengthXorMask,
pointer->andMaskData, pointer->lengthAndMask,
pointer->xorBpp, NULL) < 0)
pointer->xorBpp, NULL))
{
free(cursor_data);
mrdpCursor->cursor_data = NULL;

View File

@ -58,7 +58,7 @@ HBITMAP wf_create_dib(wfContext* wfc, UINT32 width, UINT32 height,
if (data)
freerdp_image_copy(cdata, dstFormat, 0, 0, 0, width, height, data, srcFormat, 0,
0, 0, &wfc->context.gdi->palette);
0, 0, &wfc->context.gdi->palette, FREERDP_FLIP_NONE);
if (pdata)
*pdata = cdata;
@ -243,7 +243,7 @@ static BOOL wf_Pointer_New(rdpContext* context, const rdpPointer* pointer)
if (!freerdp_image_copy_from_pointer_data(pdata, gdi->dstFormat, 0, 0, 0,
pointer->width, pointer->height,
pointer->xorMaskData, pointer->lengthXorMask,
pointer->andMaskData, pointer->lengthAndMask, pointer->xorBpp, &gdi->palette))
pointer->andMaskData, pointer->lengthAndMask, pointer->xorBpp, &gdi->palette, FREERDP_FLIP_NONE))
{
_aligned_free(pdata);
goto fail;

View File

@ -234,11 +234,11 @@ static Pixmap xf_brush_new(xfContext* xfc, UINT32 width, UINT32 height,
if (data)
{
brushFormat = gdi_get_pixel_format(bpp, FALSE);
brushFormat = gdi_get_pixel_format(bpp);
cdata = (BYTE*) _aligned_malloc(width * height * 4, 16);
freerdp_image_copy(cdata, gdi->dstFormat, 0, 0, 0,
width, height, data, brushFormat, 0, 0, 0,
&xfc->context.gdi->palette);
&xfc->context.gdi->palette, FREERDP_FLIP_NONE);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
ZPixmap, 0, (char*) cdata, width, height, xfc->scanline_pad, 0);
gc = XCreateGC(xfc->display, xfc->drawable, 0, NULL);
@ -1030,24 +1030,24 @@ static BOOL xf_gdi_surface_bits(rdpContext* context,
break;
case RDP_CODEC_ID_NSCODEC:
format = FREERDP_VFLIP_PIXEL_FORMAT(gdi->dstFormat);
format = gdi->dstFormat;
if (!nsc_process_message(context->codecs->nsc, cmd->bpp, cmd->width,
cmd->height, cmd->bitmapData, cmd->bitmapDataLength,
gdi->primary_buffer, format, stride,
0, 0, cmd->width, cmd->height))
0, 0, cmd->width, cmd->height, FREERDP_FLIP_VERTICAL))
goto fail;
break;
case RDP_CODEC_ID_NONE:
pSrcData = cmd->bitmapData;
format = PIXEL_FORMAT_BGRX32_VF;
format = PIXEL_FORMAT_BGRX32;
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, stride,
0, 0,
cmd->width, cmd->height, pSrcData,
format, 0, 0, 0, &xfc->context.gdi->palette))
format, 0, 0, 0, &xfc->context.gdi->palette, FREERDP_FLIP_VERTICAL))
goto fail;
break;

View File

@ -64,7 +64,7 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
surface->stageScanline, 0, 0,
surface->gdi.width, surface->gdi.height,
surface->gdi.data, surface->gdi.format,
surface->gdi.scanline, 0, 0, NULL);
surface->gdi.scanline, 0, 0, NULL, FREERDP_FLIP_NONE);
}
#ifdef WITH_XRENDER

View File

@ -53,8 +53,7 @@ BOOL xf_decode_color(rdpGdi* gdi, const UINT32 srcColor,
return FALSE;
xfc = (xfContext*)gdi->context;
SrcFormat = gdi_get_pixel_format(gdi->context->settings->ColorDepth,
FALSE);
SrcFormat = gdi_get_pixel_format(gdi->context->settings->ColorDepth);
if (format)
*format = SrcFormat;
@ -98,7 +97,7 @@ static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0,
bitmap->width, bitmap->height,
bitmap->data, SrcFormat,
0, 0, 0, &context->gdi->palette);
0, 0, 0, &context->gdi->palette, FREERDP_FLIP_NONE);
_aligned_free(bitmap->data);
bitmap->data = data;
bitmap->format = gdi->dstFormat;

View File

@ -35,24 +35,15 @@
#define FREERDP_PIXEL_FORMAT_IS_ABGR(_format) (FREERDP_PIXEL_FORMAT_TYPE(_format) == FREERDP_PIXEL_FORMAT_TYPE_ABGR)
#define FREERDP_PIXEL_FLIP_NONE 0
#define FREERDP_PIXEL_FLIP_VERTICAL 1
#define FREERDP_PIXEL_FLIP_HORIZONTAL 2
#define FREERDP_FLIP_NONE 0
#define FREERDP_FLIP_VERTICAL 1
#define FREERDP_FLIP_HORIZONTAL 2
#define FREERDP_PIXEL_FORMAT(_flip, _bpp, _type, _a, _r, _g, _b) \
((_flip << 30) | (_bpp << 24) | (_type << 16) | (_a << 12) | (_r << 8) | (_g << 4) | (_b))
#define FREERDP_PIXEL_FORMAT(_bpp, _type, _a, _r, _g, _b) \
((_bpp << 24) | (_type << 16) | (_a << 12) | (_r << 8) | (_g << 4) | (_b))
#define FREERDP_PIXEL_FORMAT_FLIP(_format) (((_format) >> 30) & 0x03)
#define FREERDP_PIXEL_FORMAT_TYPE(_format) (((_format) >> 16) & 0x07)
#define FREERDP_PIXEL_FORMAT_FLIP_MASKED(_format) (_format & 0x3FFFFFFF)
#define FREERDP_VFLIP_PIXEL_FORMAT(format) \
FREERDP_PIXEL_FORMAT_FLIP_MASKED(format) | (FREERDP_PIXEL_FLIP_VERTICAL << 30)
#define FREERDP_HFLIP_PIXEL_FORMAT(format) \
FREERDP_PIXEL_FORMAT_FLIP_MASKED(format) | (FREERDP_PIXEL_FLIP_HORIZONTAL << 30)
/*** Design considerations
*
* The format naming scheme is based on byte position in memory.
@ -64,92 +55,39 @@
* The single pixel manipulation functions use an intermediate integer representation
* that must not be interpreted outside the functions as it is platform dependent.
*
* _VF denotes vertically flipped bitmaps.
* X for alpha channel denotes unused (but existing) alpha channel data.
*/
/* 32bpp formats */
#define PIXEL_FORMAT_A8R8G8B8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 8, 8, 8, 8)
#define PIXEL_FORMAT_ARGB32 PIXEL_FORMAT_A8R8G8B8_F(0)
#define PIXEL_FORMAT_ARGB32_VF PIXEL_FORMAT_A8R8G8B8_F(1)
#define PIXEL_FORMAT_X8R8G8B8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
#define PIXEL_FORMAT_XRGB32 PIXEL_FORMAT_X8R8G8B8_F(0)
#define PIXEL_FORMAT_XRGB32_VF PIXEL_FORMAT_X8R8G8B8_F(1)
#define PIXEL_FORMAT_A8B8G8R8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 8, 8, 8, 8)
#define PIXEL_FORMAT_ABGR32 PIXEL_FORMAT_A8B8G8R8_F(0)
#define PIXEL_FORMAT_ABGR32_VF PIXEL_FORMAT_A8B8G8R8_F(1)
#define PIXEL_FORMAT_X8B8G8R8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
#define PIXEL_FORMAT_XBGR32 PIXEL_FORMAT_X8B8G8R8_F(0)
#define PIXEL_FORMAT_XBGR32_VF PIXEL_FORMAT_X8B8G8R8_F(1)
#define PIXEL_FORMAT_B8G8R8A8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 8, 8, 8, 8)
#define PIXEL_FORMAT_BGRA32 PIXEL_FORMAT_B8G8R8A8_F(0)
#define PIXEL_FORMAT_BGRA32_VF PIXEL_FORMAT_B8G8R8A8_F(1)
#define PIXEL_FORMAT_B8G8R8X8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 8, 8, 8)
#define PIXEL_FORMAT_BGRX32 PIXEL_FORMAT_B8G8R8X8_F(0)
#define PIXEL_FORMAT_BGRX32_VF PIXEL_FORMAT_B8G8R8X8_F(1)
#define PIXEL_FORMAT_R8G8B8A8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 8, 8, 8, 8)
#define PIXEL_FORMAT_RGBA32 PIXEL_FORMAT_R8G8B8A8_F(0)
#define PIXEL_FORMAT_RGBA32_VF PIXEL_FORMAT_R8G8B8A8_F(1)
#define PIXEL_FORMAT_R8G8B8X8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 8, 8, 8)
#define PIXEL_FORMAT_RGBX32 PIXEL_FORMAT_R8G8B8X8_F(0)
#define PIXEL_FORMAT_RGBX32_VF PIXEL_FORMAT_R8G8B8X8_F(1)
#define PIXEL_FORMAT_ARGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 8, 8, 8, 8)
#define PIXEL_FORMAT_XRGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
#define PIXEL_FORMAT_ABGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 8, 8, 8, 8)
#define PIXEL_FORMAT_XBGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
#define PIXEL_FORMAT_BGRA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 8, 8, 8, 8)
#define PIXEL_FORMAT_BGRX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 8, 8, 8)
#define PIXEL_FORMAT_RGBA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 8, 8, 8, 8)
#define PIXEL_FORMAT_RGBX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 8, 8, 8)
/* 24bpp formats */
#define PIXEL_FORMAT_R8G8B8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 24, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
#define PIXEL_FORMAT_RGB24 PIXEL_FORMAT_R8G8B8_F(0)
#define PIXEL_FORMAT_RGB24_VF PIXEL_FORMAT_R8G8B8_F(1)
#define PIXEL_FORMAT_B8G8R8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 24, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
#define PIXEL_FORMAT_BGR24 PIXEL_FORMAT_B8G8R8_F(0)
#define PIXEL_FORMAT_BGR24_VF PIXEL_FORMAT_B8G8R8_F(1)
#define PIXEL_FORMAT_RGB24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
#define PIXEL_FORMAT_BGR24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
/* 16bpp formats */
#define PIXEL_FORMAT_R5G6B5_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 6, 5)
#define PIXEL_FORMAT_RGB16 PIXEL_FORMAT_R5G6B5_F(0)
#define PIXEL_FORMAT_RGB16_VF PIXEL_FORMAT_R5G6B5_F(1)
#define PIXEL_FORMAT_B5G6R5_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 6, 5)
#define PIXEL_FORMAT_BGR16 PIXEL_FORMAT_B5G6R5_F(0)
#define PIXEL_FORMAT_BGR16_VF PIXEL_FORMAT_B5G6R5_F(1)
#define PIXEL_FORMAT_A1R5G5B5_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 1, 5, 5, 5)
#define PIXEL_FORMAT_ARGB15 PIXEL_FORMAT_A1R5G5B5_F(0)
#define PIXEL_FORMAT_ARGB15_VF PIXEL_FORMAT_A1R5G5B5_F(1)
#define PIXEL_FORMAT_X1R5G5B5_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 15, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 5, 5)
#define PIXEL_FORMAT_RGB15 PIXEL_FORMAT_X1R5G5B5_F(0)
#define PIXEL_FORMAT_RGB15_VF PIXEL_FORMAT_X1R5G5B5_F(1)
#define PIXEL_FORMAT_A1B5G5R5_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 1, 5, 5, 5)
#define PIXEL_FORMAT_ABGR15 PIXEL_FORMAT_A1B5G5R5_F(0)
#define PIXEL_FORMAT_ABGR15_VF PIXEL_FORMAT_A1B5G5R5_F(1)
#define PIXEL_FORMAT_X1B5G5R5_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 15, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 5, 5)
#define PIXEL_FORMAT_BGR15 PIXEL_FORMAT_X1B5G5R5_F(0)
#define PIXEL_FORMAT_BGR15_VF PIXEL_FORMAT_X1B5G5R5_F(1)
#define PIXEL_FORMAT_RGB16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 6, 5)
#define PIXEL_FORMAT_BGR16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 6, 5)
#define PIXEL_FORMAT_ARGB15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 1, 5, 5, 5)
#define PIXEL_FORMAT_RGB15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 5, 5)
#define PIXEL_FORMAT_ABGR15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 1, 5, 5, 5)
#define PIXEL_FORMAT_BGR15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 5, 5)
/* 8bpp formats */
#define PIXEL_FORMAT_A8_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 8, FREERDP_PIXEL_FORMAT_TYPE_A, 8, 0, 0, 0)
#define PIXEL_FORMAT_RGB8 PIXEL_FORMAT_A8_F(0)
#define PIXEL_FORMAT_RGB8_VF PIXEL_FORMAT_A8_F(1)
#define PIXEL_FORMAT_RGB8 FREERDP_PIXEL_FORMAT(8, FREERDP_PIXEL_FORMAT_TYPE_A, 8, 0, 0, 0)
/* 4 bpp formats */
#define PIXEL_FORMAT_A4_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 4, FREERDP_PIXEL_FORMAT_TYPE_A, 4, 0, 0, 0)
#define PIXEL_FORMAT_A4 PIXEL_FORMAT_A4_F(0)
#define PIXEL_FORMAT_A4_VF PIXEL_FORMAT_A4_F(1)
#define PIXEL_FORMAT_A4 FREERDP_PIXEL_FORMAT(4, FREERDP_PIXEL_FORMAT_TYPE_A, 4, 0, 0, 0)
/* 1bpp formats */
#define PIXEL_FORMAT_A1_F(_flip) FREERDP_PIXEL_FORMAT(_flip, 1, FREERDP_PIXEL_FORMAT_TYPE_A, 1, 0, 0, 0)
#define PIXEL_FORMAT_MONO PIXEL_FORMAT_A1_F(0)
#define PIXEL_FORMAT_MONO_VF PIXEL_FORMAT_A1_F(1)
#define PIXEL_FORMAT_MONO FREERDP_PIXEL_FORMAT(1, FREERDP_PIXEL_FORMAT_TYPE_A, 1, 0, 0, 0)
struct gdi_palette
{
@ -180,122 +118,65 @@ static const char* GetColorFormatName(UINT32 format)
case PIXEL_FORMAT_ARGB32:
return "PIXEL_FORMAT_ARGB32";
case PIXEL_FORMAT_ARGB32_VF:
return "PIXEL_FORMAT_ARGB32_VF";
case PIXEL_FORMAT_XRGB32:
return "PIXEL_FORMAT_XRGB32";
case PIXEL_FORMAT_XRGB32_VF:
return "PIXEL_FORMAT_XRGB32_VF";
case PIXEL_FORMAT_ABGR32:
return "PIXEL_FORMAT_ABGR32";
case PIXEL_FORMAT_ABGR32_VF:
return "PIXEL_FORMAT_ABGR32_VF";
case PIXEL_FORMAT_XBGR32:
return "PIXEL_FORMAT_XBGR32";
case PIXEL_FORMAT_XBGR32_VF:
return "PIXEL_FORMAT_XBGR32_VF";
case PIXEL_FORMAT_BGRA32:
return "PIXEL_FORMAT_BGRA32";
case PIXEL_FORMAT_BGRA32_VF:
return "PIXEL_FORMAT_BGRA32_VF";
case PIXEL_FORMAT_BGRX32:
return "PIXEL_FORMAT_BGRX32";
case PIXEL_FORMAT_BGRX32_VF:
return "PIXEL_FORMAT_BGRX32_VF";
case PIXEL_FORMAT_RGBA32:
return "PIXEL_FORMAT_RGBA32";
case PIXEL_FORMAT_RGBA32_VF:
return "PIXEL_FORMAT_RGBA32_VF";
case PIXEL_FORMAT_RGBX32:
return "PIXEL_FORMAT_RGBX32";
case PIXEL_FORMAT_RGBX32_VF:
return "PIXEL_FORMAT_RGBX32_VF";
/* 24bpp formats */
case PIXEL_FORMAT_RGB24:
return "PIXEL_FORMAT_RGB24";
case PIXEL_FORMAT_RGB24_VF:
return "PIXEL_FORMAT_RGB24_VF";
case PIXEL_FORMAT_BGR24:
return "PIXEL_FORMAT_BGR24";
case PIXEL_FORMAT_BGR24_VF:
return "PIXEL_FORMAT_BGR24_VF";
/* 16bpp formats */
case PIXEL_FORMAT_RGB16:
return "PIXEL_FORMAT_RGB16";
case PIXEL_FORMAT_RGB16_VF:
return "PIXEL_FORMAT_RGB16_VF";
case PIXEL_FORMAT_BGR16:
return "PIXEL_FORMAT_BGR16";
case PIXEL_FORMAT_BGR16_VF:
return "PIXEL_FORMAT_BGR16_VF";
case PIXEL_FORMAT_ARGB15:
return "PIXEL_FORMAT_ARGB15";
case PIXEL_FORMAT_ARGB15_VF:
return "PIXEL_FORMAT_ARGB15_VF";
case PIXEL_FORMAT_RGB15:
return "PIXEL_FORMAT_RGB15";
case PIXEL_FORMAT_RGB15_VF:
return "PIXEL_FORMAT_ABGR15";
case PIXEL_FORMAT_ABGR15:
return "";
case PIXEL_FORMAT_ABGR15_VF:
return "PIXEL_FORMAT_ABGR15_VF";
return "PIXEL_FORMAT_ABGR15";
case PIXEL_FORMAT_BGR15:
return "PIXEL_FORMAT_BGR15";
case PIXEL_FORMAT_BGR15_VF:
return "PIXEL_FORMAT_BGR15_VF";
/* 8bpp formats */
case PIXEL_FORMAT_RGB8:
return "PIXEL_FORMAT_RGB8";
case PIXEL_FORMAT_RGB8_VF:
return "PIXEL_FORMAT_RGB8_VF";
/* 4 bpp formats */
case PIXEL_FORMAT_A4:
return "PIXEL_FORMAT_A4";
case PIXEL_FORMAT_A4_VF:
return "PIXEL_FORMAT_A4_VF";
/* 1bpp formats */
case PIXEL_FORMAT_MONO:
return "PIXEL_FORMAT_MONO";
case PIXEL_FORMAT_MONO_VF:
return "PIXEL_FORMAT_MONO_VF";
default:
return "UNKNOWN";
}
@ -319,7 +200,7 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
{
UINT32 tmp;
switch (FREERDP_PIXEL_FORMAT_FLIP_MASKED(format))
switch (format)
{
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
@ -645,7 +526,7 @@ static INLINE UINT32 GetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
UINT32 _b = b;
UINT32 _a = a;
switch (FREERDP_PIXEL_FORMAT_FLIP_MASKED(format))
switch (format)
{
/* 32bpp formats */
case PIXEL_FORMAT_ARGB32:
@ -962,6 +843,7 @@ FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
* @param nXSrc source buffer x offset in pixels
* @param nYSrc source buffer y offset in pixels
* @param palette pallete to use (only used for 8 bit color!)
* @param flags Image flipping flags FREERDP_FLIP_NONE et al
*
* @return TRUE if success, FALSE otherwise
*/
@ -970,7 +852,7 @@ FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const gdiPalette* palette);
const gdiPalette* palette, UINT32 flags);
/***
*

View File

@ -92,7 +92,7 @@ FREERDP_API BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
const BYTE* data, UINT32 length,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStride, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight);
UINT32 nWidth, UINT32 nHeight, UINT32 flip);
FREERDP_API BOOL nsc_compose_message(NSC_CONTEXT* context, wStream* s,
const BYTE* bmpdata,
UINT32 width, UINT32 height, UINT32 rowstride);

View File

@ -529,7 +529,7 @@ extern "C" {
#endif
FREERDP_API DWORD gdi_rop3_code(BYTE code);
FREERDP_API UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel, BOOL vFlip);
FREERDP_API UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel);
FREERDP_API BOOL gdi_decode_color(rdpGdi* gdi, const UINT32 srcColor,
UINT32* color, UINT32* format);
FREERDP_API BOOL gdi_resize(rdpGdi* gdi, UINT32 width, UINT32 height);

View File

@ -103,7 +103,7 @@ static BOOL clear_decompress_nscodec(NSC_CONTEXT* nsc, UINT32 width,
rc = nsc_process_message(nsc, 32, width, height, Stream_Pointer(s),
bitmapDataByteCount, pDstData, DstFormat,
nDstStep, nXDstRel, nYDstRel, width, height);
nDstStep, nXDstRel, nYDstRel, width, height, FREERDP_FLIP_NONE);
Stream_Seek(s, bitmapDataByteCount);
return rc;
}

View File

@ -76,30 +76,26 @@ BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* data)
}
BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData,
UINT32 backColor, UINT32 foreColor,
const gdiPalette* palette)
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData,
UINT32 backColor, UINT32 foreColor,
const gdiPalette* palette)
{
UINT32 x, y;
BOOL vFlip;
UINT32 srcFlip;
UINT32 dstFlip;
UINT32 nDstPad;
UINT32 monoStep;
UINT32 dstBitsPerPixel;
UINT32 dstBytesPerPixel;
dstBitsPerPixel = GetBitsPerPixel(DstFormat);
dstBytesPerPixel = GetBytesPerPixel(DstFormat);
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
if (nDstStep == 0)
nDstStep = dstBytesPerPixel * nWidth;
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
srcFlip = FREERDP_PIXEL_FLIP_NONE;
vFlip = (srcFlip != dstFlip) ? TRUE : FALSE;
vFlip = FALSE;
monoStep = (nWidth + 7) / 8;
for (y = 0; y < nHeight; y++)
@ -135,7 +131,7 @@ BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
}
static INLINE UINT32 freerdp_image_inverted_pointer_color(UINT32 x, UINT32 y,
UINT32 format)
UINT32 format)
{
#if 1
/**
@ -171,8 +167,6 @@ BOOL freerdp_image_copy_from_pointer_data(
{
UINT32 x, y;
BOOL vFlip;
UINT32 srcFlip;
UINT32 dstFlip;
UINT32 nDstPad;
UINT32 xorStep;
UINT32 andStep;
@ -184,20 +178,12 @@ BOOL freerdp_image_copy_from_pointer_data(
UINT32 dstBytesPerPixel;
dstBitsPerPixel = GetBitsPerPixel(DstFormat);
dstBytesPerPixel = GetBytesPerPixel(DstFormat);
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
if (FREERDP_PIXEL_FORMAT_FLIP(DstFormat))
{
WLog_ERR(TAG, "Format %s not supported!", GetColorFormatName(DstFormat));
return FALSE;
}
if (nDstStep <= 0)
nDstStep = dstBytesPerPixel * nWidth;
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
srcFlip = (xorBpp == 1) ? FREERDP_PIXEL_FLIP_NONE : FREERDP_PIXEL_FLIP_VERTICAL;
vFlip = (srcFlip != dstFlip) ? TRUE : FALSE;
vFlip = (xorBpp == 1) ? FALSE : TRUE;
andStep = (nWidth + 7) / 8;
andStep += (andStep % 2);
@ -224,7 +210,7 @@ BOOL freerdp_image_copy_from_pointer_data(
const BYTE* andBits;
const BYTE* xorBits;
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
(nXDst * GetBytesPerPixel(DstFormat))];
(nXDst * GetBytesPerPixel(DstFormat))];
xorBit = andBit = 0x80;
if (!vFlip)
@ -284,7 +270,7 @@ BOOL freerdp_image_copy_from_pointer_data(
if (xorBpp == 8 && !palette)
{
WLog_ERR(TAG, "null palette in convertion from %d bpp to %d bpp",
xorBpp, dstBitsPerPixel);
xorBpp, dstBitsPerPixel);
return -1;
}
@ -302,7 +288,7 @@ BOOL freerdp_image_copy_from_pointer_data(
const BYTE* xorBits;
const BYTE* andBits = NULL;
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
(nXDst * GetBytesPerPixel(DstFormat))];
(nXDst * GetBytesPerPixel(DstFormat))];
andBit = 0x80;
if (!vFlip)
@ -353,9 +339,9 @@ BOOL freerdp_image_copy_from_pointer_data(
}
xorPixel = ConvertColor(xorPixel,
pixelFormat,
PIXEL_FORMAT_ARGB32,
palette);
pixelFormat,
PIXEL_FORMAT_ARGB32,
palette);
xorBits += xorBytesPerPixel;
andPixel = 0;
@ -382,7 +368,7 @@ BOOL freerdp_image_copy_from_pointer_data(
}
color = ConvertColor(xorPixel, PIXEL_FORMAT_ARGB32,
DstFormat, palette);
DstFormat, palette);
WriteColor(pDstPixel, DstFormat, color);
pDstPixel += GetBytesPerPixel(DstFormat);
}
@ -393,16 +379,16 @@ BOOL freerdp_image_copy_from_pointer_data(
default:
WLog_ERR(TAG, "failed to convert from %d bpp to %d bpp",
xorBpp, dstBitsPerPixel);
xorBpp, dstBitsPerPixel);
return -1;
}
}
static BOOL overlapping(const BYTE* pDstData, UINT32 nXDst, UINT32 nYDst,
UINT32 nDstStep, UINT32 dstBytesPerPixel,
const BYTE* pSrcData, UINT32 nXSrc, UINT32 nYSrc,
UINT32 nSrcStep, UINT32 srcBytesPerPixel,
UINT32 nWidth, UINT32 nHeight)
UINT32 nDstStep, UINT32 dstBytesPerPixel,
const BYTE* pSrcData, UINT32 nXSrc, UINT32 nYSrc,
UINT32 nSrcStep, UINT32 srcBytesPerPixel,
UINT32 nWidth, UINT32 nHeight)
{
const BYTE* pDstStart = &pDstData[nXDst * dstBytesPerPixel + nYDst * nDstStep];
const BYTE* pDstEnd = pDstStart + nHeight * nDstStep;
@ -419,21 +405,19 @@ static BOOL overlapping(const BYTE* pDstData, UINT32 nXDst, UINT32 nYDst,
}
BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const gdiPalette* palette)
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const gdiPalette* palette, UINT32 flags)
{
const UINT32 dstByte = GetBytesPerPixel(DstFormat);
const UINT32 srcByte = GetBytesPerPixel(SrcFormat);
const UINT32 copyDstWidth = nWidth * dstByte;
const UINT32 xSrcOffset = nXSrc * srcByte;
const UINT32 xDstOffset = nXDst * dstByte;
BOOL vSrcVFlip = FALSE;
BOOL vDstVFlip = FALSE;
BOOL vSrcHFlip = FALSE;
BOOL vDstHFlip = FALSE;
BOOL vSrcVFlip = flags & FREERDP_FLIP_VERTICAL;
BOOL vSrcHFlip = flags & FREERDP_FLIP_HORIZONTAL;
UINT32 srcVOffset = 0;
INT32 srcVMultiplier = 1;
UINT32 dstVOffset = 0;
@ -442,36 +426,6 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
if (!pDstData || !pSrcData)
return FALSE;
switch (FREERDP_PIXEL_FORMAT_FLIP(SrcFormat))
{
case FREERDP_PIXEL_FLIP_HORIZONTAL:
vSrcHFlip = TRUE;
return FALSE;
case FREERDP_PIXEL_FLIP_VERTICAL:
vSrcVFlip = TRUE;
break;
case FREERDP_PIXEL_FLIP_NONE:
default:
break;
}
switch (FREERDP_PIXEL_FORMAT_FLIP(DstFormat))
{
case FREERDP_PIXEL_FLIP_HORIZONTAL:
vDstHFlip = TRUE;
return FALSE;
case FREERDP_PIXEL_FLIP_VERTICAL:
vDstVFlip = TRUE;
break;
case FREERDP_PIXEL_FLIP_NONE:
default:
break;
}
if (nDstStep == 0)
nDstStep = nWidth * GetBytesPerPixel(DstFormat);
@ -484,27 +438,13 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
srcVMultiplier = -1;
}
if (vDstVFlip)
{
dstVOffset = (nHeight - 1) * nDstStep;
dstVMultiplier = -1;
}
if (vSrcHFlip || vDstHFlip)
{
WLog_ERR(TAG, "Horizontal flipping not supported! %s %s",
GetColorFormatName(SrcFormat), GetColorFormatName(DstFormat));
return FALSE;
}
if (FREERDP_PIXEL_FORMAT_FLIP_MASKED(SrcFormat) ==
FREERDP_PIXEL_FORMAT_FLIP_MASKED(DstFormat))
if (SrcFormat == DstFormat)
{
INT32 y;
if (overlapping(pDstData, nXDst, nYDst, nDstStep, dstByte,
pSrcData, nXSrc, nYSrc, nSrcStep, srcByte,
nWidth, nHeight))
pSrcData, nXSrc, nYSrc, nSrcStep, srcByte,
nWidth, nHeight))
{
/* Copy down */
if (nYDst < nYSrc)
@ -512,11 +452,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
nDstStep * dstVMultiplier +
dstVOffset];
memcpy(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
@ -527,11 +467,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
for (y = nHeight - 1; y >= 0; y--)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
nDstStep * dstVMultiplier +
dstVOffset];
memcpy(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
@ -542,13 +482,13 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
nDstStep * dstVMultiplier +
dstVOffset];
memmove(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
&srcLine[xSrcOffset], copyDstWidth);
}
}
/* Copy right */
@ -557,13 +497,13 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
for (y = nHeight - 1; y >= 0; y--)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
nDstStep * dstVMultiplier +
dstVOffset];
memmove(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
&srcLine[xSrcOffset], copyDstWidth);
}
}
/* Source and destination are equal... */
@ -576,11 +516,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
nDstStep * dstVMultiplier +
dstVOffset];
memcpy(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
@ -593,16 +533,16 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier + dstVOffset];
nDstStep * dstVMultiplier + dstVOffset];
for (x = 0; x < nWidth; x++)
{
UINT32 dstColor;
UINT32 color = ReadColor(&srcLine[(x + nXSrc) * srcByte],
SrcFormat);
SrcFormat);
dstColor = ConvertColor(color, SrcFormat, DstFormat, palette);
WriteColor(&dstLine[(x + nXDst) * dstByte], DstFormat, dstColor);
}
@ -613,8 +553,8 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
}
BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, UINT32 color)
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight, UINT32 color)
{
UINT32 x, y;

View File

@ -109,7 +109,7 @@ static INLINE UINT32 ExtractCodeId(BYTE bOrderHdr)
* 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;
@ -252,9 +252,9 @@ static INLINE UINT32 ExtractRunLength(UINT32 code, const BYTE* pbOrderHdr,
#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
@ -264,13 +264,13 @@ static INLINE UINT32 ExtractRunLength(UINT32 code, const BYTE* pbOrderHdr,
#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;
@ -283,22 +283,22 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
{
case 24:
scanline = nSrcWidth * 3;
SrcFormat = PIXEL_FORMAT_BGR24_VF;
SrcFormat = PIXEL_FORMAT_BGR24;
break;
case 16:
scanline = nSrcWidth * 2;
SrcFormat = PIXEL_FORMAT_RGB16_VF;
SrcFormat = PIXEL_FORMAT_RGB16;
break;
case 15:
scanline = nSrcWidth * 2;
SrcFormat = PIXEL_FORMAT_RGB15_VF;
SrcFormat = PIXEL_FORMAT_RGB15;
break;
case 8:
scanline = nSrcWidth;
SrcFormat = PIXEL_FORMAT_RGB8_VF;
SrcFormat = PIXEL_FORMAT_RGB8;
break;
default:
@ -311,8 +311,8 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
if (BufferSize > interleaved->TempSize)
{
interleaved->TempBuffer = _aligned_realloc(
interleaved->TempBuffer,
BufferSize, 16);
interleaved->TempBuffer,
BufferSize, 16);
interleaved->TempSize = BufferSize;
}
@ -323,18 +323,18 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
{
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:
@ -342,16 +342,16 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
}
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, FREERDP_FLIP_VERTICAL);
}
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;
@ -367,8 +367,8 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
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;
}
@ -385,16 +385,16 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
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, FREERDP_FLIP_NONE);
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);
@ -413,7 +413,7 @@ BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new(BOOL Compressor)
{
BITMAP_INTERLEAVED_CONTEXT* interleaved;
interleaved = (BITMAP_INTERLEAVED_CONTEXT*) calloc(1,
sizeof(BITMAP_INTERLEAVED_CONTEXT));
sizeof(BITMAP_INTERLEAVED_CONTEXT));
if (interleaved)
{

View File

@ -48,7 +48,6 @@ static void nsc_decode(NSC_CONTEXT* context)
UINT16 y;
UINT16 rw = ROUND_UP_TO(context->width, 8);
BYTE shift = context->ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */;
BYTE* bmpdata = context->BitmapData;
for (y = 0; y < context->height; y++)
@ -62,9 +61,9 @@ static void nsc_decode(NSC_CONTEXT* context)
{
yplane = context->priv->PlaneBuffers[0] + y * rw; /* Y */
coplane = context->priv->PlaneBuffers[1] + (y >> 1) * (rw >>
1); /* Co, supersampled */
1); /* Co, supersampled */
cgplane = context->priv->PlaneBuffers[2] + (y >> 1) * (rw >>
1); /* Cg, supersampled */
1); /* Cg, supersampled */
}
else
{
@ -81,7 +80,6 @@ static void nsc_decode(NSC_CONTEXT* context)
INT16 r_val = y_val + co_val - cg_val;
INT16 g_val = y_val + cg_val;
INT16 b_val = y_val - co_val - cg_val;
*bmpdata++ = MINMAX(b_val, 0, 0xFF);
*bmpdata++ = MINMAX(g_val, 0, 0xFF);
*bmpdata++ = MINMAX(r_val, 0, 0xFF);
@ -176,7 +174,7 @@ static BOOL nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
Stream_Read_UINT8(s, context->ColorLossLevel); /* ColorLossLevel (1 byte) */
Stream_Read_UINT8(s,
context->ChromaSubsamplingLevel); /* ChromaSubsamplingLevel (1 byte) */
context->ChromaSubsamplingLevel); /* ChromaSubsamplingLevel (1 byte) */
Stream_Seek(s, 2); /* Reserved (2 bytes) */
context->Planes = Stream_Pointer(s);
return TRUE;
@ -295,10 +293,10 @@ NSC_CONTEXT* nsc_context_new(void)
goto error_PlanePool;
PROFILER_CREATE(context->priv->prof_nsc_rle_decompress_data,
"nsc_rle_decompress_data");
"nsc_rle_decompress_data");
PROFILER_CREATE(context->priv->prof_nsc_decode, "nsc_decode");
PROFILER_CREATE(context->priv->prof_nsc_rle_compress_data,
"nsc_rle_compress_data");
"nsc_rle_compress_data");
PROFILER_CREATE(context->priv->prof_nsc_encode, "nsc_encode");
/* Default encoding parameters */
context->ColorLossLevel = 3;
@ -345,12 +343,12 @@ BOOL nsc_context_set_pixel_format(NSC_CONTEXT* context, UINT32 pixel_format)
}
BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
UINT32 width, UINT32 height,
const BYTE* data, UINT32 length,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStride,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
UINT32 nHeight)
UINT32 width, UINT32 height,
const BYTE* data, UINT32 length,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStride,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
UINT32 nHeight, UINT32 flip)
{
wStream* s;
BOOL ret;
@ -406,8 +404,8 @@ BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
PROFILER_EXIT(context->priv->prof_nsc_decode);
if (!freerdp_image_copy(pDstData, DstFormat, nDstStride, nXDst, nYDst,
width, height, context->BitmapData,
PIXEL_FORMAT_BGRA32, 0, 0, 0, NULL))
width, height, context->BitmapData,
PIXEL_FORMAT_BGRA32, 0, 0, 0, NULL, flip))
return FALSE;
return TRUE;

View File

@ -559,7 +559,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
{
if (!freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst, w,
h, pTempData,
TempFormat, nTempStep, nXDst, nYDst, NULL))
TempFormat, nTempStep, nXDst, nYDst, NULL, FREERDP_FLIP_NONE))
return FALSE;
}
}

View File

@ -1930,7 +1930,7 @@ INT32 progressive_decompress(PROGRESSIVE_CONTEXT* progressive,
rect->left, rect->top,
width, height,
tile->data, PIXEL_FORMAT_BGRX32,
64 * 4, nXSrc, nYSrc, NULL))
64 * 4, nXSrc, nYSrc, NULL, FREERDP_FLIP_NONE))
{
rc = -42;
break;

View File

@ -1188,7 +1188,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
if (!freerdp_image_copy(dst, dstFormat, dstStride,
nXDst, nYDst, nWidth, nHeight,
tile->data, format, stride, nXSrc, nYSrc, NULL))
tile->data, format, stride, nXSrc, nYSrc, NULL, FREERDP_FLIP_NONE))
goto fail;
if (invalidRegion)

View File

@ -169,7 +169,8 @@ static void* test_image_memset32(UINT32* ptr, UINT32 fill, size_t length)
return (void*) ptr;
}
static int test_image_fill(BYTE* pDstData, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight, UINT32 color)
static int test_image_fill(BYTE* pDstData, int nDstStep, int nXDst, int nYDst, int nWidth,
int nHeight, UINT32 color)
{
int y;
UINT32* pDstPixel;
@ -186,7 +187,8 @@ static int test_image_fill(BYTE* pDstData, int nDstStep, int nXDst, int nYDst, i
return 1;
}
static int test_image_fill_quarter(BYTE* pDstData, int nDstStep, int nWidth, int nHeight, UINT32 color, int quarter)
static int test_image_fill_quarter(BYTE* pDstData, int nDstStep, int nWidth, int nHeight,
UINT32 color, int quarter)
{
int x = 0;
int y = 0;
@ -199,37 +201,37 @@ static int test_image_fill_quarter(BYTE* pDstData, int nDstStep, int nWidth, int
x = 0;
y = 0;
width = nWidth / 2;
height = nHeight /2;
height = nHeight / 2;
break;
case 1:
x = nWidth / 2;
y = nHeight / 2;
width = nWidth / 2;
height = nHeight /2;
height = nHeight / 2;
break;
case 2:
x = 0;
y = nHeight / 2;
width = nWidth / 2;
height = nHeight /2;
height = nHeight / 2;
break;
case 3:
x = nWidth / 2;
y = 0;
width = nWidth / 2;
height = nHeight /2;
height = nHeight / 2;
break;
}
test_image_fill(pDstData, nDstStep, x, y, width, height, 0xFF000000);
return 1;
}
static int test_image_fill_unused_quarters(BYTE* pDstData, int nDstStep, int nWidth, int nHeight, UINT32 color, int quarter)
static int test_image_fill_unused_quarters(BYTE* pDstData, int nDstStep, int nWidth, int nHeight,
UINT32 color, int quarter)
{
return 1;
@ -266,8 +268,8 @@ BYTE* test_progressive_load_file(char* path, char* file, UINT32* size)
FILE* fp;
BYTE* buffer;
char* filename;
filename = GetCombinedPath(path, file);
if (!filename)
return NULL;
@ -280,7 +282,6 @@ BYTE* test_progressive_load_file(char* path, char* file, UINT32* size)
fseek(fp, 0, SEEK_END);
*size = ftell(fp);
fseek(fp, 0, SEEK_SET);
buffer = (BYTE*) malloc(*size);
if (!buffer)
@ -297,7 +298,6 @@ BYTE* test_progressive_load_file(char* path, char* file, UINT32* size)
}
fclose(fp);
return buffer;
}
@ -306,225 +306,163 @@ int test_progressive_load_files(char* ms_sample_path, EGFX_SAMPLE_FILE files[3][
int imageNo = 0;
int quarterNo = 0;
int passNo = 0;
/* image 1 */
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_0_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_0_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_0_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_0_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_0_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_0_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_0_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_0_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_1_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_1_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_1_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_1_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_1_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_1_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_1_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_1_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_2_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_2_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_2_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_2_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_2_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_2_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_2_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_2_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_3_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_3_025_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_3_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_3_050_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_3_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_3_075_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_0_3_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_0_3_100_sampleimage1.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
imageNo++;
/* image 2 */
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_0_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_0_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_0_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_0_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_0_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_0_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_0_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_0_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_1_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_1_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_1_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_1_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_1_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_1_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_1_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_1_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_2_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_2_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_2_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_2_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_2_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_2_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_2_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_2_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_3_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_3_025_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_3_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_3_050_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_3_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_3_075_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_1_3_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_1_3_100_sampleimage2.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
imageNo++;
/* image 3 */
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_0_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_0_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_0_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_0_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_0_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_0_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_0_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_0_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_1_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_1_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_1_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_1_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_1_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_1_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_1_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_1_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_2_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_2_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_2_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_2_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_2_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_2_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_2_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_2_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_3_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_3_025_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_3_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_3_050_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_3_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_3_075_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
files[imageNo][quarterNo][passNo].buffer = test_progressive_load_file(ms_sample_path,
"compress/enc_2_3_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
"compress/enc_2_3_100_sampleimage3.bin", &(files[imageNo][quarterNo][passNo].size));
passNo = (passNo + 1) % 4;
/* check if all test data has been loaded */
@ -550,7 +488,6 @@ BYTE* test_progressive_load_bitmap(char* path, char* file, UINT32* size, int qua
BYTE* buffer;
wImage* image;
char* filename;
filename = GetCombinedPath(path, file);
if (!filename)
@ -568,13 +505,11 @@ BYTE* test_progressive_load_bitmap(char* path, char* file, UINT32* size, int qua
buffer = image->data;
*size = image->height * image->scanline;
test_fill_image_alpha_channel(image->data, image->width, image->height, 0xFF);
test_image_fill_unused_quarters(image->data, image->scanline, image->width, image->height, quarter, 0xFF000000);
test_image_fill_unused_quarters(image->data, image->scanline, image->width, image->height, quarter,
0xFF000000);
winpr_image_free(image, FALSE);
free(filename);
return buffer;
}
@ -583,225 +518,163 @@ int test_progressive_load_bitmaps(char* ms_sample_path, EGFX_SAMPLE_FILE bitmaps
int imageNo = 0;
int quarterNo = 0;
int passNo = 0;
/* image 1 */
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_0_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_0_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_0_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_0_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_0_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_0_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_0_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_0_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_1_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_1_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_1_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_1_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_1_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_1_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_1_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_1_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_2_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_2_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_2_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_2_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_2_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_2_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_2_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_2_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_3_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_3_025_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_3_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_3_050_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_3_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_3_075_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_0_3_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_0_3_100_sampleimage1.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
imageNo++;
/* image 2 */
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_0_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_0_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_0_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_0_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_0_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_0_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_0_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_0_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_1_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_1_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_1_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_1_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_1_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_1_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_1_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_1_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_2_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_2_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_2_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_2_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_2_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_2_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_2_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_2_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_3_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_3_025_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_3_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_3_050_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_3_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_3_075_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_1_3_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_1_3_100_sampleimage2.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
imageNo++;
/* image 3 */
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_0_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_0_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_0_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_0_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_0_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_0_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_0_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_0_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_1_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_1_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_1_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_1_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_1_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_1_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_1_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_1_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_2_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_2_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_2_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_2_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_2_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_2_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_2_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_2_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
quarterNo = (quarterNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_3_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_3_025_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_3_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_3_050_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_3_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_3_075_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
bitmaps[imageNo][quarterNo][passNo].buffer = test_progressive_load_bitmap(ms_sample_path,
"decompress/dec_2_3_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
"decompress/dec_2_3_100_sampleimage3.bmp", &(bitmaps[imageNo][quarterNo][passNo].size), quarterNo);
passNo = (passNo + 1) % 4;
/* check if all test data has been loaded */
@ -844,7 +717,8 @@ static int test_memcmp_count(const BYTE* mem1, const BYTE* mem2, int size, int m
return count;
}
static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE_FILE files[4], EGFX_SAMPLE_FILE bitmaps[4], int quarter, int count)
static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE_FILE files[4],
EGFX_SAMPLE_FILE bitmaps[4], int quarter, int count)
{
int cnt;
int pass;
@ -859,7 +733,6 @@ static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE
RECTANGLE_16 clippingRect;
RFX_PROGRESSIVE_TILE* tile;
PROGRESSIVE_BLOCK_REGION* region;
clippingRect.left = 0;
clippingRect.top = 0;
clippingRect.right = g_Width;
@ -868,10 +741,8 @@ static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE
for (pass = 0; pass < count; pass++)
{
status = progressive_decompress(progressive, files[pass].buffer, files[pass].size,
g_DstData, PIXEL_FORMAT_XRGB32, g_DstStep, 0, 0, g_Width, g_Height, 0);
g_DstData, PIXEL_FORMAT_XRGB32, g_DstStep, 0, 0, g_Width, g_Height, 0);
printf("ProgressiveDecompress: status: %d pass: %d\n", status, pass + 1);
region = &(progressive->region);
switch (quarter)
@ -880,7 +751,7 @@ static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE
clippingRect.left = 0;
clippingRect.top = 0;
clippingRect.right = g_Width / 2;
clippingRect.bottom = g_Height /2;
clippingRect.bottom = g_Height / 2;
break;
case 1:
@ -908,14 +779,11 @@ static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE
for (index = 0; index < region->numTiles; index++)
{
tile = region->tiles[index];
tileRect.left = tile->x;
tileRect.top = tile->y;
tileRect.right = tile->x + tile->width;
tileRect.bottom = tile->y + tile->height;
rectangles_intersection(&tileRect, &clippingRect, &updateRect);
nXDst = updateRect.left;
nYDst = updateRect.top;
nWidth = updateRect.right - updateRect.left;
@ -926,10 +794,9 @@ static int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE
nXSrc = nXDst - tile->x;
nYSrc = nYDst - tile->y;
freerdp_image_copy(g_DstData, PIXEL_FORMAT_XRGB32, g_DstStep,
nXDst, nYDst, nWidth, nHeight, tile->data,
PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
nXDst, nYDst, nWidth, nHeight, tile->data,
PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL, FREERDP_FLIP_NONE);
}
size = bitmaps[pass].size;
@ -956,23 +823,20 @@ static int test_progressive_ms_sample(char* ms_sample_path)
EGFX_SAMPLE_FILE files[3][4][4];
EGFX_SAMPLE_FILE bitmaps[3][4][4];
PROGRESSIVE_CONTEXT* progressive;
g_Width = 1920;
g_Height = 1080;
g_DstStep = g_Width * 4;
ZeroMemory(files, sizeof(files));
ZeroMemory(bitmaps, sizeof(bitmaps));
status = test_progressive_load_files(ms_sample_path, files);
if (status < 0)
{
for(i=0; i<3; i++)
for (i = 0; i < 3; i++)
{
for (j=0; j<4; j++)
for (j = 0; j < 4; j++)
{
for (k=0; k<4; k++)
for (k = 0; k < 4; k++)
sample_file_free(&files[i][j][k]);
}
}
@ -984,11 +848,11 @@ static int test_progressive_ms_sample(char* ms_sample_path)
if (status < 0)
{
for(i=0; i<3; i++)
for (i = 0; i < 3; i++)
{
for (j=0; j<4; j++)
for (j = 0; j < 4; j++)
{
for (k=0; k<4; k++)
for (k = 0; k < 4; k++)
sample_file_free(&files[i][j][k]);
}
}
@ -997,11 +861,8 @@ static int test_progressive_ms_sample(char* ms_sample_path)
}
count = 4;
progressive = progressive_context_new(FALSE);
g_DstData = _aligned_malloc(g_DstStep * g_Height, 16);
progressive_create_surface_context(progressive, 0, g_Width, g_Height);
/* image 1 */
@ -1042,28 +903,27 @@ static int test_progressive_ms_sample(char* ms_sample_path)
progressive_context_free(progressive);
for(i=0; i<3; i++)
for (i = 0; i < 3; i++)
{
for (j=0; j<4; j++)
for (j = 0; j < 4; j++)
{
for (k=0; k<4; k++)
for (k = 0; k < 4; k++)
{
sample_file_free(&bitmaps[i][j][k]);
sample_file_free(&files[i][j][k]);
sample_file_free(&bitmaps[i][j][k]);
sample_file_free(&files[i][j][k]);
}
}
}
_aligned_free(g_DstData);
return 0;
}
int TestFreeRDPCodecProgressive(int argc, char* argv[])
{
char* ms_sample_path;
ms_sample_path = GetKnownSubPath(KNOWN_PATH_TEMP, "EGFX_PROGRESSIVE_MS_SAMPLE");
if (!ms_sample_path)
{
printf("Memory allocation failed\n");
@ -1074,6 +934,5 @@ int TestFreeRDPCodecProgressive(int argc, char* argv[])
return test_progressive_ms_sample(ms_sample_path);
free(ms_sample_path);
return 0;
}

View File

@ -485,7 +485,7 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
if (!freerdp_image_copy(hDstBmp->data, hdcDest->format, hDstBmp->scanline,
nXDest, nYDest, nWidth, nHeight,
hSrcBmp->data, hdcSrc->format, hSrcBmp->scanline, nXSrc, nYSrc, palette))
hSrcBmp->data, hdcSrc->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
return FALSE;
break;
@ -496,7 +496,7 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
if (!freerdp_image_copy(hDstBmp->data, hdcDest->format, hDstBmp->scanline,
nXDest, nYDest, nWidth, nHeight,
hSrcBmp->data, hdcSrc->format, hSrcBmp->scanline, nXSrc, nYSrc, palette))
hSrcBmp->data, hdcSrc->format, hSrcBmp->scanline, nXSrc, nYSrc, palette, FREERDP_FLIP_NONE))
return FALSE;
break;

View File

@ -322,8 +322,7 @@ static const BYTE GDI_BS_HATCHED_PATTERNS[] =
INLINE BOOL gdi_decode_color(rdpGdi* gdi, const UINT32 srcColor,
UINT32* color, UINT32* format)
{
UINT32 SrcFormat = gdi_get_pixel_format(gdi->context->settings->ColorDepth,
FALSE);
UINT32 SrcFormat = gdi_get_pixel_format(gdi->context->settings->ColorDepth);
if (format)
*format = SrcFormat;
@ -339,30 +338,30 @@ INLINE DWORD gdi_rop3_code(BYTE code)
return rop3_code_table[code];
}
UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel, BOOL vFlip)
UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel)
{
UINT32 format = PIXEL_FORMAT_XBGR32_VF;
UINT32 format = PIXEL_FORMAT_XBGR32;
switch (bitsPerPixel)
{
case 32:
format = vFlip ? PIXEL_FORMAT_ABGR32_VF : PIXEL_FORMAT_ABGR32;
format = PIXEL_FORMAT_ABGR32;
break;
case 24:
format = vFlip ? PIXEL_FORMAT_BGR24_VF : PIXEL_FORMAT_BGR24;
format = PIXEL_FORMAT_BGR24;
break;
case 16:
format = vFlip ? PIXEL_FORMAT_RGB16_VF : PIXEL_FORMAT_RGB16;
format = PIXEL_FORMAT_RGB16;
break;
case 15:
format = vFlip ? PIXEL_FORMAT_RGB15_VF : PIXEL_FORMAT_RGB15;
format = PIXEL_FORMAT_RGB15;
break;
case 8:
format = vFlip ? PIXEL_FORMAT_RGB8_VF : PIXEL_FORMAT_RGB8;
format = PIXEL_FORMAT_RGB8;
break;
}
@ -576,11 +575,11 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
if (brush->bpp > 1)
{
brushFormat = gdi_get_pixel_format(brush->bpp, FALSE);
brushFormat = gdi_get_pixel_format(brush->bpp);
if (!freerdp_image_copy(data, gdi->drawing->hdc->format, 0, 0, 0,
8, 8, brush->data, brushFormat, 0, 0, 0,
&gdi->palette))
&gdi->palette, FREERDP_FLIP_NONE))
goto out_error;
}
else
@ -822,11 +821,11 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
if (brush->bpp > 1)
{
brushFormat = gdi_get_pixel_format(brush->bpp, FALSE);
brushFormat = gdi_get_pixel_format(brush->bpp);
if (!freerdp_image_copy(data, gdi->drawing->hdc->format, 0, 0, 0,
8, 8, brush->data, brushFormat,
0, 0, 0, &gdi->palette))
0, 0, 0, &gdi->palette, FREERDP_FLIP_NONE))
{
ret = FALSE;
_aligned_free(data);
@ -978,24 +977,24 @@ static BOOL gdi_surface_bits(rdpContext* context,
break;
case RDP_CODEC_ID_NSCODEC:
format = FREERDP_VFLIP_PIXEL_FORMAT(gdi->dstFormat);
format = gdi->dstFormat;
if (!nsc_process_message(context->codecs->nsc, cmd->bpp, cmd->width,
cmd->height, cmd->bitmapData,
cmd->bitmapDataLength, gdi->primary_buffer,
format, gdi->stride, cmd->destLeft, cmd->destTop,
cmd->width, cmd->height))
cmd->width, cmd->height, FREERDP_FLIP_VERTICAL))
return FALSE;
break;
case RDP_CODEC_ID_NONE:
format = PIXEL_FORMAT_BGRX32_VF;
format = PIXEL_FORMAT_BGRX32;
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
cmd->destLeft, cmd->destTop, cmd->width, cmd->height,
cmd->bitmapData, format, 0, 0, 0,
&gdi->palette))
&gdi->palette, FREERDP_FLIP_VERTICAL))
return FALSE;
break;
@ -1161,7 +1160,7 @@ BOOL gdi_init(freerdp* instance, UINT32 format)
BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
void (*pfree)(void*))
{
UINT32 SrcFormat = gdi_get_pixel_format(instance->settings->ColorDepth, FALSE);
UINT32 SrcFormat = gdi_get_pixel_format(instance->settings->ColorDepth);
rdpGdi* gdi = (rdpGdi*) calloc(1, sizeof(rdpGdi));
rdpContext* context = instance->context;

View File

@ -121,7 +121,7 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface)
gdi->stride,
nXDst, nYDst, width, height,
surface->data, surface->format,
surface->scanline, nXSrc, nYSrc, NULL))
surface->scanline, nXSrc, nYSrc, NULL, FREERDP_FLIP_NONE))
return CHANNEL_RC_NULL_DATA;
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, width, height);
@ -210,7 +210,7 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
if (!freerdp_image_copy(surface->data, surface->format, surface->scanline,
cmd->left, cmd->top, cmd->width, cmd->height,
cmd->data, cmd->format, 0, 0, 0, NULL))
cmd->data, cmd->format, 0, 0, 0, NULL, FREERDP_FLIP_NONE))
return ERROR_INTERNAL_ERROR;
invalidRect.left = cmd->left;
@ -843,7 +843,7 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
destPt->x, destPt->y, nWidth, nHeight,
surfaceSrc->data, surfaceSrc->format,
surfaceSrc->scanline,
rectSrc->left, rectSrc->top, NULL);
rectSrc->left, rectSrc->top, NULL, FREERDP_FLIP_NONE);
invalidRect.left = destPt->x;
invalidRect.top = destPt->y;
invalidRect.right = destPt->x + rectSrc->right;
@ -898,7 +898,7 @@ static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
freerdp_image_copy(cacheEntry->data, cacheEntry->format, cacheEntry->scanline,
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
surface->format, surface->scanline, rect->left, rect->top, NULL);
surface->format, surface->scanline, rect->left, rect->top, NULL, FREERDP_FLIP_NONE);
context->SetCacheSlotData(context, surfaceToCache->cacheSlot,
(void*) cacheEntry);
return CHANNEL_RC_OK;
@ -932,7 +932,7 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
destPt = &cacheToSurface->destPts[index];
freerdp_image_copy(surface->data, surface->format, surface->scanline,
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL, FREERDP_FLIP_NONE);
invalidRect.left = destPt->x;
invalidRect.top = destPt->y;
invalidRect.right = destPt->x + cacheEntry->width - 1;

View File

@ -40,7 +40,7 @@
/* 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;
@ -61,8 +61,8 @@ HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, UINT32 nWidth, UINT32 nHeight,
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, FREERDP_FLIP_NONE))
{
_aligned_free(pDstData);
return NULL;
@ -84,14 +84,14 @@ static BOOL gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
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)
@ -124,25 +124,23 @@ static BOOL gdi_Bitmap_Paint(rdpContext* context, rdpBitmap* 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 DstWidth, UINT32 DstHeight,
UINT32 bpp, UINT32 length, BOOL compressed,
UINT32 codecId)
const BYTE* pSrcData, UINT32 DstWidth, UINT32 DstHeight,
UINT32 bpp, UINT32 length, BOOL compressed,
UINT32 codecId)
{
UINT32 SrcSize = length;
UINT32 SrcFormat;
UINT32 bytesPerPixel;
rdpGdi* gdi = context->gdi;
bitmap->compressed = FALSE;
bitmap->format = gdi->dstFormat;
bitmap->length = DstWidth * DstHeight * GetBytesPerPixel(bitmap->format);
bytesPerPixel = GetBytesPerPixel(bpp);
bitmap->data = (BYTE*) _aligned_malloc(bitmap->length, 16);
@ -154,30 +152,30 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
if (bpp < 32)
{
if (!interleaved_decompress(context->codecs->interleaved,
pSrcData, SrcSize,
DstWidth, DstHeight,
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,
DstWidth, DstHeight,
bitmap->data, bitmap->format, 0, 0, 0,
DstWidth, DstHeight, TRUE))
DstWidth, DstHeight,
bitmap->data, bitmap->format, 0, 0, 0,
DstWidth, DstHeight, TRUE))
return FALSE;
}
}
else
{
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
SrcFormat = gdi_get_pixel_format(bpp);
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, FREERDP_FLIP_VERTICAL))
return FALSE;
}
@ -185,7 +183,7 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
}
static BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
BOOL primary)
BOOL primary)
{
rdpGdi* gdi = context->gdi;
@ -222,7 +220,7 @@ static BOOL gdi_Glyph_New(rdpContext* context, const rdpGlyph* glyph)
}
gdi_glyph->bitmap = gdi_CreateBitmap(glyph->cx, glyph->cy, PIXEL_FORMAT_MONO,
data);
data);
if (!gdi_glyph->bitmap)
{
@ -252,7 +250,7 @@ static void gdi_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
}
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;
@ -300,14 +298,14 @@ static BOOL gdi_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, UINT32 x,
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;
@ -355,7 +353,7 @@ static BOOL gdi_Glyph_BeginDraw(rdpContext* context, UINT32 x, UINT32 y,
}
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;

View File

@ -37,7 +37,7 @@ HGDI_BITMAP test_convert_to_bitmap(const BYTE* src, UINT32 SrcFormat,
return NULL;
if (!freerdp_image_copy(data, DstFormat, DstStride, xDst, yDst, nWidth, nHeight,
src, SrcFormat, SrcStride, xSrc, ySrc, hPalette))
src, SrcFormat, SrcStride, xSrc, ySrc, hPalette, FREERDP_FLIP_NONE))
{
_aligned_free(data);
return NULL;

View File

@ -394,7 +394,7 @@ static void (^mac_capture_stream_handler)(CGDisplayStreamFrameStatus, uint64_t,
else
{
freerdp_image_copy(surface->data, surface->format, surface->scanline,
x, y, width, height, pSrcData, PIXEL_FORMAT_BGRX32, nSrcStep, x, y, NULL);
x, y, width, height, pSrcData, PIXEL_FORMAT_BGRX32, nSrcStep, x, y, NULL, FREERDP_FLIP_NONE);
}
IOSurfaceUnlock(frameSurface, kIOSurfaceLockReadOnly, NULL);

View File

@ -269,7 +269,7 @@ int win_shadow_surface_copy(winShadowSubsystem* subsystem)
freerdp_image_copy(surface->data, surface->format,
surface->scanline, x - surface->x, y - surface->y, width, height,
pDstData, DstFormat, nDstStep, 0, 0, NULL);
pDstData, DstFormat, nDstStep, 0, 0, NULL, FREERDP_FLIP_NONE);
ArrayList_Lock(server->clients);
count = ArrayList_Count(server->clients);
shadow_subsystem_frame_update((rdpShadowSubsystem*)subsystem);

View File

@ -68,7 +68,7 @@ struct _SHADOW_PAM_AUTH_INFO
typedef struct _SHADOW_PAM_AUTH_INFO SHADOW_PAM_AUTH_INFO;
static int x11_shadow_pam_conv(int num_msg, const struct pam_message** msg,
struct pam_response** resp, void* appdata_ptr)
struct pam_response** resp, void* appdata_ptr)
{
int index;
int pam_status = PAM_BUF_ERR;
@ -77,7 +77,7 @@ static int x11_shadow_pam_conv(int num_msg, const struct pam_message** msg,
appdata = (SHADOW_PAM_AUTH_DATA*) appdata_ptr;
if (!(response = (struct pam_response*) calloc(num_msg,
sizeof(struct pam_response))))
sizeof(struct pam_response))))
return PAM_BUF_ERR;
for (index = 0; index < num_msg; index++)
@ -161,8 +161,8 @@ static int x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
}
static int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem,
rdpShadowClient* client, const char* user, const char* domain,
const char* password)
rdpShadowClient* client, const char* user, const char* domain,
const char* password)
{
int pam_status;
SHADOW_PAM_AUTH_INFO* info;
@ -196,7 +196,7 @@ static int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem,
if (pam_status != PAM_SUCCESS)
{
WLog_ERR(TAG, "pam_authenticate failure: %s", pam_strerror(info->handle,
pam_status));
pam_status));
free(info);
return -1;
}
@ -206,7 +206,7 @@ static int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem,
if (pam_status != PAM_SUCCESS)
{
WLog_ERR(TAG, "pam_acct_mgmt failure: %s", pam_strerror(info->handle,
pam_status));
pam_status));
free(info);
return -1;
}
@ -218,12 +218,12 @@ static int x11_shadow_pam_authenticate(x11ShadowSubsystem* subsystem,
#endif
static void x11_shadow_input_synchronize_event(x11ShadowSubsystem* subsystem,
rdpShadowClient* client, UINT32 flags)
rdpShadowClient* client, UINT32 flags)
{
}
static void x11_shadow_input_keyboard_event(x11ShadowSubsystem* subsystem,
rdpShadowClient* client, UINT16 flags, UINT16 code)
rdpShadowClient* client, UINT16 flags, UINT16 code)
{
#ifdef WITH_XTEST
DWORD vkcode;
@ -262,13 +262,13 @@ static void x11_shadow_input_keyboard_event(x11ShadowSubsystem* subsystem,
}
static void x11_shadow_input_unicode_keyboard_event(x11ShadowSubsystem*
subsystem,
rdpShadowClient* client, UINT16 flags, UINT16 code)
subsystem,
rdpShadowClient* client, UINT16 flags, UINT16 code)
{
}
static void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem,
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
{
#ifdef WITH_XTEST
int button = 0;
@ -320,7 +320,7 @@ static void x11_shadow_input_mouse_event(x11ShadowSubsystem* subsystem,
}
static void x11_shadow_input_extended_mouse_event(x11ShadowSubsystem* subsystem,
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
rdpShadowClient* client, UINT16 flags, UINT16 x, UINT16 y)
{
#ifdef WITH_XTEST
int button = 0;
@ -383,7 +383,7 @@ static int x11_shadow_pointer_position_update(x11ShadowSubsystem* subsystem)
int count = 0;
int index = 0;
msg = (SHADOW_MSG_OUT_POINTER_POSITION_UPDATE*) calloc(1,
sizeof(SHADOW_MSG_OUT_POINTER_POSITION_UPDATE));
sizeof(SHADOW_MSG_OUT_POINTER_POSITION_UPDATE));
if (!msg)
return -1;
@ -415,7 +415,7 @@ static int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE* msg;
UINT32 msgId = SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE_ID;
msg = (SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE*) calloc(1,
sizeof(SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE));
sizeof(SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE));
if (!msg)
return -1;
@ -426,8 +426,8 @@ static int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
msg->height = subsystem->cursorHeight;
if (shadow_subsystem_pointer_convert_alpha_pointer_data(subsystem->cursorPixels,
TRUE,
msg->width, msg->height, msg) < 0)
TRUE,
msg->width, msg->height, msg) < 0)
{
free(msg);
return -1;
@ -435,7 +435,7 @@ static int x11_shadow_pointer_alpha_update(x11ShadowSubsystem* subsystem)
msg->Free = x11_shadow_message_free;
return shadow_client_boardcast_msg(subsystem->server, NULL, msgId,
(SHADOW_MSG_OUT*) msg, NULL) ? 1 : -1;
(SHADOW_MSG_OUT*) msg, NULL) ? 1 : -1;
}
static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
@ -494,7 +494,7 @@ static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
XLockDisplay(subsystem->display);
if (!XQueryPointer(subsystem->display, subsystem->root_window,
&root, &child, &root_x, &root_y, &win_x, &win_y, &mask))
&root, &child, &root_x, &root_y, &win_x, &win_y, &mask))
{
XUnlockDisplay(subsystem->display);
return -1;
@ -523,7 +523,7 @@ static int x11_shadow_query_cursor(x11ShadowSubsystem* subsystem, BOOL getImage)
}
static int x11_shadow_handle_xevent(x11ShadowSubsystem* subsystem,
XEvent* xevent)
XEvent* xevent)
{
if (xevent->type == MotionNotify)
{
@ -544,8 +544,8 @@ static int x11_shadow_handle_xevent(x11ShadowSubsystem* subsystem,
}
static void x11_shadow_validate_region(x11ShadowSubsystem* subsystem, int x,
int y,
int width, int height)
int y,
int width, int height)
{
XRectangle region;
@ -560,7 +560,7 @@ static void x11_shadow_validate_region(x11ShadowSubsystem* subsystem, int x,
XLockDisplay(subsystem->display);
XFixesSetRegion(subsystem->display, subsystem->xdamage_region, &region, 1);
XDamageSubtract(subsystem->display, subsystem->xdamage,
subsystem->xdamage_region, None);
subsystem->xdamage_region, None);
XUnlockDisplay(subsystem->display);
#endif
}
@ -701,12 +701,12 @@ static BOOL x11_shadow_check_resize(x11ShadowSubsystem* subsystem)
}
static int x11_shadow_error_handler_for_capture(Display* display,
XErrorEvent* event)
XErrorEvent* event)
{
char msg[256];
XGetErrorText(display, event->error_code, (char*) &msg, sizeof(msg));
WLog_ERR(TAG, "X11 error: %s Error code: %x, request code: %x, minor code: %x",
msg, event->error_code, event->request_code, event->minor_code);
msg, event->error_code, event->request_code, event->minor_code);
/* Ignore BAD MATCH error during image capture. Abort in other case */
if (event->error_code != BadMatch)
@ -753,16 +753,16 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
{
image = subsystem->fb_image;
XCopyArea(subsystem->display, subsystem->root_window, subsystem->fb_pixmap,
subsystem->xshm_gc, 0, 0, subsystem->width, subsystem->height, 0, 0);
subsystem->xshm_gc, 0, 0, subsystem->width, subsystem->height, 0, 0);
status = shadow_capture_compare(surface->data, surface->scanline,
surface->width, surface->height,
(BYTE*) & (image->data[surface->width * 4]), image->bytes_per_line,
&invalidRect);
surface->width, surface->height,
(BYTE*) & (image->data[surface->width * 4]), image->bytes_per_line,
&invalidRect);
}
else
{
image = XGetImage(subsystem->display, subsystem->root_window,
surface->x, surface->y, surface->width, surface->height, AllPlanes, ZPixmap);
surface->x, surface->y, surface->width, surface->height, AllPlanes, ZPixmap);
if (!image)
{
@ -774,8 +774,8 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
}
status = shadow_capture_compare(surface->data, surface->scanline,
surface->width, surface->height,
(BYTE*) image->data, image->bytes_per_line, &invalidRect);
surface->width, surface->height,
(BYTE*) image->data, image->bytes_per_line, &invalidRect);
}
/* Restore the default error handler */
@ -783,9 +783,9 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
XSync(subsystem->display, False);
XUnlockDisplay(subsystem->display);
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&invalidRect);
&invalidRect);
region16_intersect_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&surfaceRect);
&surfaceRect);
if (!region16_is_empty(&(surface->invalidRegion)))
{
@ -795,9 +795,9 @@ static int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem)
width = extents->right - extents->left;
height = extents->bottom - extents->top;
freerdp_image_copy(surface->data, surface->format,
surface->scanline, x, y, width, height,
(BYTE*) image->data, PIXEL_FORMAT_BGRX32,
image->bytes_per_line, x, y, NULL);
surface->scanline, x, y, width, height,
(BYTE*) image->data, PIXEL_FORMAT_BGRX32,
image->bytes_per_line, x, y, NULL, FREERDP_FLIP_NONE);
//x11_shadow_blend_cursor(subsystem);
count = ArrayList_Count(server->clients);
shadow_subsystem_frame_update((rdpShadowSubsystem*)subsystem);
@ -828,7 +828,7 @@ fail_capture:
}
static int x11_shadow_subsystem_process_message(x11ShadowSubsystem* subsystem,
wMessage* message)
wMessage* message)
{
switch (message->id)
{
@ -955,7 +955,7 @@ static int x11_shadow_xfixes_init(x11ShadowSubsystem* subsystem)
subsystem->xfixes_cursor_notify_event = xfixes_event + XFixesCursorNotify;
XFixesSelectCursorInput(subsystem->display, subsystem->root_window,
XFixesDisplayCursorNotifyMask);
XFixesDisplayCursorNotifyMask);
return 1;
#else
return -1;
@ -971,7 +971,7 @@ static int x11_shadow_xinerama_init(x11ShadowSubsystem* subsystem)
x11_shadow_subsystem_base_init(subsystem);
if (!XineramaQueryExtension(subsystem->display, &xinerama_event,
&xinerama_error))
&xinerama_error))
return -1;
if (!XDamageQueryVersion(subsystem->display, &major, &minor))
@ -1007,7 +1007,7 @@ static int x11_shadow_xdamage_init(x11ShadowSubsystem* subsystem)
subsystem->xdamage_notify_event = damage_event + XDamageNotify;
subsystem->xdamage = XDamageCreate(subsystem->display, subsystem->root_window,
XDamageReportDeltaRectangles);
XDamageReportDeltaRectangles);
if (!subsystem->xdamage)
return -1;
@ -1044,8 +1044,8 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
subsystem->fb_shm_info.shmaddr = (char*) - 1;
subsystem->fb_shm_info.readOnly = False;
subsystem->fb_image = XShmCreateImage(subsystem->display, subsystem->visual,
subsystem->depth,
ZPixmap, NULL, &(subsystem->fb_shm_info), subsystem->width, subsystem->height);
subsystem->depth,
ZPixmap, NULL, &(subsystem->fb_shm_info), subsystem->width, subsystem->height);
if (!subsystem->fb_image)
{
@ -1054,8 +1054,8 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
}
subsystem->fb_shm_info.shmid = shmget(IPC_PRIVATE,
subsystem->fb_image->bytes_per_line * subsystem->fb_image->height,
IPC_CREAT | 0600);
subsystem->fb_image->bytes_per_line * subsystem->fb_image->height,
IPC_CREAT | 0600);
if (subsystem->fb_shm_info.shmid == -1)
{
@ -1078,9 +1078,9 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
XSync(subsystem->display, False);
shmctl(subsystem->fb_shm_info.shmid, IPC_RMID, 0);
subsystem->fb_pixmap = XShmCreatePixmap(subsystem->display,
subsystem->root_window, subsystem->fb_image->data, &(subsystem->fb_shm_info),
subsystem->fb_image->width, subsystem->fb_image->height,
subsystem->fb_image->depth);
subsystem->root_window, subsystem->fb_image->data, &(subsystem->fb_shm_info),
subsystem->fb_image->width, subsystem->fb_image->height,
subsystem->fb_image->depth);
XSync(subsystem->display, False);
if (!subsystem->fb_pixmap)
@ -1089,7 +1089,7 @@ static int x11_shadow_xshm_init(x11ShadowSubsystem* subsystem)
values.subwindow_mode = IncludeInferiors;
values.graphics_exposures = False;
subsystem->xshm_gc = XCreateGC(subsystem->display, subsystem->root_window,
GCSubwindowMode | GCGraphicsExposures, &values);
GCSubwindowMode | GCGraphicsExposures, &values);
XSetFunction(subsystem->display, subsystem->xshm_gc, GXcopy);
XSync(subsystem->display, False);
return 1;
@ -1231,7 +1231,7 @@ static int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
template.class = TrueColor;
template.screen = subsystem->number;
vis = XGetVisualInfo(subsystem->display, VisualClassMask | VisualScreenMask,
&template, &vi_count);
&template, &vi_count);
if (!vis)
{
@ -1252,11 +1252,11 @@ static int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
XFree(vis);
XSelectInput(subsystem->display, subsystem->root_window,
SubstructureNotifyMask);
SubstructureNotifyMask);
subsystem->cursorMaxWidth = 256;
subsystem->cursorMaxHeight = 256;
subsystem->cursorPixels = _aligned_malloc(subsystem->cursorMaxWidth *
subsystem->cursorMaxHeight * 4, 16);
subsystem->cursorMaxHeight * 4, 16);
if (!subsystem->cursorPixels)
return -1;
@ -1288,7 +1288,7 @@ static int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
}
if (!(subsystem->event = CreateFileDescriptorEvent(NULL, FALSE, FALSE,
subsystem->xfds, WINPR_FD_READ)))
subsystem->xfds, WINPR_FD_READ)))
return -1;
virtualScreen = &(subsystem->virtualScreen);
@ -1298,8 +1298,8 @@ static int x11_shadow_subsystem_init(x11ShadowSubsystem* subsystem)
virtualScreen->bottom = subsystem->height;
virtualScreen->flags = 1;
WLog_INFO(TAG, "X11 Extensions: XFixes: %d Xinerama: %d XDamage: %d XShm: %d",
subsystem->use_xfixes, subsystem->use_xinerama, subsystem->use_xdamage,
subsystem->use_xshm);
subsystem->use_xfixes, subsystem->use_xinerama, subsystem->use_xdamage,
subsystem->use_xshm);
return 1;
}
@ -1335,8 +1335,8 @@ static int x11_shadow_subsystem_start(x11ShadowSubsystem* subsystem)
return -1;
if (!(subsystem->thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) x11_shadow_subsystem_thread,
(void*) subsystem, 0, NULL)))
(LPTHREAD_START_ROUTINE) x11_shadow_subsystem_thread,
(void*) subsystem, 0, NULL)))
{
WLog_ERR(TAG, "Failed to create thread");
return -1;