From db3fa9a0d2fc0d31112437b602212a187b14702d Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 26 Aug 2015 12:14:46 +0200 Subject: [PATCH] Added gdi_CreateBitmapEx function. --- include/freerdp/gdi/bitmap.h | 2 + libfreerdp/gdi/bitmap.c | 7 +- libfreerdp/gdi/gdi.c | 16 ++-- libfreerdp/gdi/graphics.c | 4 +- libfreerdp/gdi/test/TestGdiBitBlt.c | 120 +++++++++++++-------------- libfreerdp/gdi/test/TestGdiClip.c | 4 +- libfreerdp/gdi/test/TestGdiCreate.c | 4 +- libfreerdp/gdi/test/TestGdiEllipse.c | 6 +- libfreerdp/gdi/test/TestGdiLine.c | 56 ++++++------- 9 files changed, 113 insertions(+), 106 deletions(-) diff --git a/include/freerdp/gdi/bitmap.h b/include/freerdp/gdi/bitmap.h index e9d327ae0..d1165e0e6 100644 --- a/include/freerdp/gdi/bitmap.h +++ b/include/freerdp/gdi/bitmap.h @@ -39,6 +39,8 @@ FREERDP_API void gdi_SetPixel_8bpp(HGDI_BITMAP hBmp, int X, int Y, BYTE pixel); FREERDP_API void gdi_SetPixel_16bpp(HGDI_BITMAP hBmp, int X, int Y, UINT16 pixel); FREERDP_API void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, UINT32 pixel); FREERDP_API HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, + BYTE* data); +FREERDP_API HGDI_BITMAP gdi_CreateBitmapEx(int nWidth, int nHeight, int cBitsPerPixel, BYTE* data, void (*fkt_free)(void*)); FREERDP_API HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight); FREERDP_API BOOL gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, DWORD rop); diff --git a/libfreerdp/gdi/bitmap.c b/libfreerdp/gdi/bitmap.c index b5cd25b73..03486d8f6 100644 --- a/libfreerdp/gdi/bitmap.c +++ b/libfreerdp/gdi/bitmap.c @@ -134,7 +134,12 @@ INLINE void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, UINT32 pixel) * @return new bitmap */ -HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, BYTE* data, +HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, BYTE* data) +{ + return gdi_CreateBitmapEx(nWidth, nHeight, cBitsPerPixel, data, _aligned_free); +} + +HGDI_BITMAP gdi_CreateBitmapEx(int nWidth, int nHeight, int cBitsPerPixel, BYTE* data, void (*fkt_free)(void*)) { HGDI_BITMAP hBitmap = (HGDI_BITMAP) calloc(1, sizeof(GDI_BITMAP)); diff --git a/libfreerdp/gdi/gdi.c b/libfreerdp/gdi/gdi.c index 4e4d70cbb..11d4ade42 100644 --- a/libfreerdp/gdi/gdi.c +++ b/libfreerdp/gdi/gdi.c @@ -645,7 +645,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) freerdp_image_copy_from_monochrome(data, gdi->format, -1, 0, 0, 8, 8, hatched, backColor, foreColor, gdi->palette); - hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data, _aligned_free); + hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data); if (!hBmp) { _aligned_free(data); @@ -703,7 +703,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt) brush->data, backColor, foreColor, gdi->palette); } - hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data, _aligned_free); + hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data); if (!hBmp) { _aligned_free(data); @@ -937,7 +937,7 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt) brush->data, backColor, foreColor, gdi->palette); } - hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data, _aligned_free); + hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data); if (!hBmp) { _aligned_free(data); @@ -1102,8 +1102,8 @@ static BOOL gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd) freerdp_image_copy(pDstData, gdi->format, -1, 0, 0, cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette); - gdi_DeleteObject(gdi->image->bitmap); - gdi->image->bitmap = gdi_CreateBitmap(cmd->width, cmd->height, cmd->bpp, gdi->bitmap_buffer, NULL); + gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap); + gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height, cmd->bpp, gdi->bitmap_buffer, NULL); gdi_SelectObject(gdi->image->hdc, (HGDIOBJECT) gdi->image->bitmap); gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY); @@ -1125,8 +1125,8 @@ static BOOL gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd) freerdp_image_copy(pDstData, gdi->format, -1, 0, 0, cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette); - gdi_DeleteObject(gdi->image->bitmap); - gdi->image->bitmap = gdi_CreateBitmap(cmd->width, cmd->height, cmd->bpp, gdi->bitmap_buffer, NULL); + gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap); + gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height, cmd->bpp, gdi->bitmap_buffer, NULL); gdi_SelectObject(gdi->image->hdc, (HGDIOBJECT) gdi->image->bitmap); gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop, cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY); @@ -1193,7 +1193,7 @@ BOOL gdi_init_primary(rdpGdi* gdi) if (!gdi->primary_buffer) gdi->primary->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, gdi->width, gdi->height); else - gdi->primary->bitmap = gdi_CreateBitmap(gdi->width, gdi->height, gdi->dstBpp, + gdi->primary->bitmap = gdi_CreateBitmapEx(gdi->width, gdi->height, gdi->dstBpp, gdi->primary_buffer, NULL); if (!gdi->primary->bitmap) diff --git a/libfreerdp/gdi/graphics.c b/libfreerdp/gdi/graphics.c index 8acb95394..8e53c5280 100644 --- a/libfreerdp/gdi/graphics.c +++ b/libfreerdp/gdi/graphics.c @@ -92,7 +92,7 @@ HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int nWidth, int nHeight, int bpp, BYT freerdp_image_copy(pDstData, gdi->format, nDstStep, 0, 0, nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, 0, 0, gdi->palette); - bitmap = gdi_CreateBitmap(nWidth, nHeight, gdi->dstBpp, pDstData, _aligned_free); + bitmap = gdi_CreateBitmap(nWidth, nHeight, gdi->dstBpp, pDstData); return bitmap; } @@ -241,7 +241,7 @@ BOOL gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph) gdi_DeleteDC(gdi_glyph->hdc); return FALSE; } - gdi_glyph->bitmap = gdi_CreateBitmap(glyph->cx, glyph->cy, 1, data, _aligned_free); + gdi_glyph->bitmap = gdi_CreateBitmap(glyph->cx, glyph->cy, 1, data); if (!gdi_glyph->bitmap) { gdi_DeleteDC(gdi_glyph->hdc); diff --git a/libfreerdp/gdi/test/TestGdiBitBlt.c b/libfreerdp/gdi/test/TestGdiBitBlt.c index a45f5488f..d9f51d79a 100644 --- a/libfreerdp/gdi/test/TestGdiBitBlt.c +++ b/libfreerdp/gdi/test/TestGdiBitBlt.c @@ -589,64 +589,64 @@ int test_gdi_BitBlt_32bpp(void) clrconv->palette = hPalette; data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); - hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data, _aligned_free); + hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); gdi_SelectObject(hdcDst, (HGDIOBJECT) hBmpDst); @@ -1013,64 +1013,64 @@ int test_gdi_BitBlt_16bpp(void) clrconv->palette = hPalette; data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); - hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data, _aligned_free); + hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); gdi_SelectObject(hdcDst, (HGDIOBJECT) hBmpDst); @@ -1435,64 +1435,64 @@ int test_gdi_BitBlt_8bpp(void) clrconv->palette = hPalette; data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRC, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpSrc = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpDst = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DST, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmpDstOriginal = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PAT, NULL, 8, 8, 8, bitsPerPixel, clrconv); - hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data, _aligned_free); + hBmpPat = gdi_CreateBitmap(8, 8, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SPna, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SPna = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_BLACKNESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_BLACKNESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_WHITENESS, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_WHITENESS = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCAND, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCAND = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_SRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_SRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_NOTSRCCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_NOTSRCERASE, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_NOTSRCERASE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_DSTINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_DSTINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGECOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_MERGECOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_MERGEPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_MERGEPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATCOPY, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATCOPY = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATPAINT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATPAINT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) bmp_PATINVERT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_PATINVERT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); gdi_SelectObject(hdcSrc, (HGDIOBJECT) hBmpSrc); gdi_SelectObject(hdcDst, (HGDIOBJECT) hBmpDst); diff --git a/libfreerdp/gdi/test/TestGdiClip.c b/libfreerdp/gdi/test/TestGdiClip.c index 61f897a5d..627d36919 100644 --- a/libfreerdp/gdi/test/TestGdiClip.c +++ b/libfreerdp/gdi/test/TestGdiClip.c @@ -28,7 +28,7 @@ int test_gdi_ClipCoords(void) hdc->bytesPerPixel = 4; hdc->bitsPerPixel = 32; - bmp = gdi_CreateBitmap(1024, 768, 4, NULL, NULL); + bmp = gdi_CreateBitmapEx(1024, 768, 4, NULL, NULL); gdi_SelectObject(hdc, (HGDIOBJECT) bmp); gdi_SetNullClipRgn(hdc); @@ -186,7 +186,7 @@ int test_gdi_InvalidateRegion(void) hdc->bytesPerPixel = 4; hdc->bitsPerPixel = 32; - bmp = gdi_CreateBitmap(1024, 768, 4, NULL, NULL); + bmp = gdi_CreateBitmapEx(1024, 768, 4, NULL, NULL); gdi_SelectObject(hdc, (HGDIOBJECT) bmp); gdi_SetNullClipRgn(hdc); diff --git a/libfreerdp/gdi/test/TestGdiCreate.c b/libfreerdp/gdi/test/TestGdiCreate.c index 16ef8ae5e..584d68362 100644 --- a/libfreerdp/gdi/test/TestGdiCreate.c +++ b/libfreerdp/gdi/test/TestGdiCreate.c @@ -83,7 +83,7 @@ int test_gdi_CreateBitmap(void) return -1; } - if (!(hBitmap = gdi_CreateBitmap(width, height, bpp, data, _aligned_free))) + if (!(hBitmap = gdi_CreateBitmap(width, height, bpp, data))) { printf("gdi_CreateBitmap failed\n"); return -1; @@ -199,7 +199,7 @@ int test_gdi_CreatePatternBrush(void) HGDI_BRUSH hBrush; HGDI_BITMAP hBitmap; - hBitmap = gdi_CreateBitmap(64, 64, 32, NULL, NULL); + hBitmap = gdi_CreateBitmap(64, 64, 32, NULL); hBrush = gdi_CreatePatternBrush(hBitmap); if (hBrush->objectType != GDIOBJECT_BRUSH) diff --git a/libfreerdp/gdi/test/TestGdiEllipse.c b/libfreerdp/gdi/test/TestGdiEllipse.c index be46d3591..7d3b107e6 100644 --- a/libfreerdp/gdi/test/TestGdiEllipse.c +++ b/libfreerdp/gdi/test/TestGdiEllipse.c @@ -120,13 +120,13 @@ int TestGdiEllipse(int argc, char* argv[]) clrconv->palette = hPalette; data = (BYTE*) freerdp_image_convert((BYTE*) ellipse_case_1, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_Ellipse_1 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_Ellipse_1 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) ellipse_case_2, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_Ellipse_2 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_Ellipse_2 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) ellipse_case_3, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_Ellipse_3 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_Ellipse_3 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); /* Test Case 1: (0,0) -> (16, 16) */ if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS)) diff --git a/libfreerdp/gdi/test/TestGdiLine.c b/libfreerdp/gdi/test/TestGdiLine.c index 87b1dff70..1ae64a030 100644 --- a/libfreerdp/gdi/test/TestGdiLine.c +++ b/libfreerdp/gdi/test/TestGdiLine.c @@ -667,88 +667,88 @@ int TestGdiLine(int argc, char* argv[]) clrconv->palette = hPalette; data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_1, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_1 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_1 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_2, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_2 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_2 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_3, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_3 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_3 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_4, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_4 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_4 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_5, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_5 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_5 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_5, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_5 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_5 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_6, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_6 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_6 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_7, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_7 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_7 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_8, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_8 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_8 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_9, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_9 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_9 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_10, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_10 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_10 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_case_11, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_11 = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_11 = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_BLACK, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_BLACK = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_BLACK = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTMERGEPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_NOTMERGEPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_NOTMERGEPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MASKNOTPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_MASKNOTPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_MASKNOTPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTCOPYPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_NOTCOPYPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_NOTCOPYPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MASKPENNOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_MASKPENNOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_MASKPENNOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_NOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_NOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_XORPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_XORPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_XORPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTMASKPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_NOTMASKPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_NOTMASKPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MASKPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_MASKPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_MASKPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOTXORPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_NOTXORPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_NOTXORPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_NOP, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_NOP = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_NOP = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MERGENOTPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_MERGENOTPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_MERGENOTPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_COPYPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_COPYPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_COPYPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MERGEPENNOT, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_MERGEPENNOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_MERGEPENNOT = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_MERGEPEN, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_MERGEPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_MERGEPEN = gdi_CreateBitmap(16, 16, bitsPerPixel, data); data = (BYTE*) freerdp_image_convert((BYTE*) line_to_R2_WHITE, NULL, 16, 16, 8, bitsPerPixel, clrconv); - hBmp_LineTo_R2_WHITE = gdi_CreateBitmap(16, 16, bitsPerPixel, data, _aligned_free); + hBmp_LineTo_R2_WHITE = gdi_CreateBitmap(16, 16, bitsPerPixel, data); /* Test Case 1: (0,0) -> (15, 15) */ if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS))