14#define WIN32_NO_STATUS
73 return ((
width *
bpp + 31) >> 3) & ~3;
79 *
abs(
info->bmiHeader.biHeight );
83 int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
84 int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
89 memset(dstBuffer, 0, dst_size);
91 hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc,
SRCCOPY);
93 "StretchBlt \nexp { %08X, %08X, %08X, %08X } \ngot { %08X, %08X, %08X, %08X } \n"
94 "destination { %d, %d, %d, %d } source { %d, %d, %d, %d } from line %d\n",
96 dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3],
97 nXOriginDest, nYOriginDest, nWidthDest, nHeightDest,
98 nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc,
line);
102 int nXOriginDest,
int nYOriginDest,
int nWidthDest,
int nHeightDest,
103 int nXOriginSrc,
int nYOriginSrc,
int nWidthSrc,
int nHeightSrc,
108 memset(dstBuffer, 0, dst_size);
110 hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc,
SRCCOPY);
112 "Case%c%c%c%c %s - %s \nexp { %08X, %08X, %08X, %08X } \ngot { %08X, %08X, %08X, %08X }\n"
113 "destination { %d, %d, %d, %d } source { %d, %d, %d, %d } from line %d\n",
114 (nWidthDest < 0) ?
'0' :
'1', (nHeightDest < 0) ?
'0' :
'1',
115 (nWidthSrc < 0) ?
'0' :
'1', (nHeightSrc < 0) ?
'0' :
'1',
116 SrcTopDown ?
"SrcTopDown" :
"SrcBottomUp", DstTopDown ?
"DstTopDown" :
"DstBottomUp",
118 dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3],
119 nXOriginDest, nYOriginDest, nWidthDest, nHeightDest,
120 nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc,
line);
128 UINT32 *dstBuffer, *srcBuffer;
153 srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE;
154 srcBuffer[16] = 0xFEDCBA98, srcBuffer[17] = 0x76543210;
160 0, 0, 2, 2, 0, 0, 2, 2,
expected, __LINE__);
165 0, 0, 1, 1, 0, 0, 1, 1,
expected, __LINE__);
170 0, 0, 2, 2, 0, 0, 1, 1,
expected, __LINE__);
176 0, 0, 1, 1, 0, 0, 2, 2,
expected, __LINE__);
181 1, 1, -2, -2, 1, 1, -2, -2,
expected, __LINE__);
188 1, 1, 2, 2, 0, 0, 2, 2,
expected, __LINE__);
192 srcBuffer[0] = 0x0000ff00, srcBuffer[1] = 0x0000f0f0, srcBuffer[2] = 0x0000cccc, srcBuffer[3] = 0x0000aaaa;
193 srcBuffer[16] = 0xFEDCBA98, srcBuffer[17] = 0x76543210;
198 0, 0, 1, 1, 0, 0, 2, 1,
expected, __LINE__);
204 0, 0, 1, 1, 0, 0, 1, 2,
expected, __LINE__);
218 srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE;
219 srcBuffer[16] = 0xFEDCBA98, srcBuffer[17] = 0x76543210;
230 0, 0, 2, 2, 0, 0, 2, 2,
expected, __LINE__);
238 srcBuffer[224] = 0xCAFED00D, srcBuffer[225] = 0xFEEDFACE;
239 srcBuffer[240] = 0xFEDCBA98, srcBuffer[241] = 0x76543210;
247 0, 0, 2, 2, 0, 0, 2, 2,
expected, __LINE__);
261 0, 0, 2, 2, 0, 0, 2, 2,
expected, __LINE__);
275 StretchBlt(
hdcSrc, 0, 0, 4, 1,
hdcDst, 0, 0, 4, 1,
SRCCOPY );
276 memset(dstBuffer, 0x55, 4 *
sizeof(*dstBuffer));
277 StretchBlt(
hdcDst, 0, 0, 4, 1,
hdcSrc, 0, 0, 4, 1,
SRCCOPY );
281 "StretchBlt expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X }\n",
283 dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3] );
288 memset(dstBuffer, 0x55, 4 *
sizeof(*dstBuffer));
289 StretchBlt(
hdcDst, 0, 0, 4, 1,
hdcSrc, 0, 0, 4, 1,
SRCCOPY );
293 "StretchBlt expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X }\n",
295 dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3] );
303 *((
DWORD *)colors + 0) = 0x123456;
304 *((
DWORD *)colors + 1) = 0x335577;
306 srcBuffer[0] = 0x55555555;
307 memset(dstBuffer, 0xcc, 4 *
sizeof(*dstBuffer));
310 StretchBlt(
hdcDst, 0, 0, 4, 1,
hdcSrc, 0, 0, 4, 1,
SRCCOPY );
314 "StretchBlt expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X }\n",
316 dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3] );
327 memset(dstBuffer, 0xcc, 4 *
sizeof(*dstBuffer));
330 StretchBlt(
hdcDst, 0, 0, 4, 1,
hdcSrc, 0, 0, 4, 1,
SRCCOPY );
334 "StretchBlt expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X }\n",
336 dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3] );
362 srcBuffer[0] = 0x000000FF;
363 srcBuffer[1] = 0x0000FF00;
364 srcBuffer[2] = 0x00FF0000;
365 srcBuffer[3] = 0xFF000000;
373 0, 0, 2, 2, 0, 0, 2, 2,
expected, __LINE__);
381 0, 0, 2, 2, 0, 1, 2, -2,
expected, __LINE__);
389 0, 0, 2, 2, 1, 0, -2, 2,
expected, __LINE__);
397 0, 0, 2, 2, 1, 1, -2, -2,
expected, __LINE__);
405 0, 1, 2, -2, 0, 0, 2, 2,
expected, __LINE__);
413 0, 2, 2, -2, 0, 2, 2, -2,
expected, __LINE__);
421 0, 1, 2, -2, 1, 0, -2, 2,
expected, __LINE__);
429 0, 1, 2, -2, 1, 1, -2, -2,
expected, __LINE__);
437 1, 0, -2, 2, 0, 0, 2, 2,
expected, __LINE__);
445 1, 0, -2, 2, 0, 1, 2, -2,
expected, __LINE__);
453 2, 0, -2, 2, 2, 0, -2, 2,
expected, __LINE__);
461 1, 0, -2, 2, 1, 1, -2, -2,
expected, __LINE__);
469 1, 1, -2, -2, 0, 0, 2, 2,
expected, __LINE__);
477 1, 1, -2, -2, 0, 1, 2, -2,
expected, __LINE__);
485 1, 1, -2, -2, 1, 0, -2, 2,
expected, __LINE__);
493 2, 2, -2, -2, 2, 2, -2, -2,
expected, __LINE__);
509 UINT32 *dstBuffer, *srcBuffer;
523 if (!SrcTopDown && !DstTopDown)
548 srcBuffer[0] = 0x000000FF;
549 srcBuffer[1] = 0x0000FF00;
550 srcBuffer[2] = 0x00FF0000;
551 srcBuffer[3] = 0xFF000000;
553 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
569 0, 0, 2, 2, 0, 0, 2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
571 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
587 0, 0, 2, 2, 0, 1, 2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
589 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
605 0, 0, 2, 2, 1, 0, -2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
607 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
623 0, 0, 2, 2, 1, 1, -2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
625 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
641 0, 1, 2, -2, 0, 0, 2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
643 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
659 0, 2, 2, -2, 0, 2, 2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
661 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
677 0, 1, 2, -2, 1, 0, -2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
679 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
695 0, 1, 2, -2, 1, 1, -2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
697 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
713 1, 0, -2, 2, 0, 0, 2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
715 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
731 1, 0, -2, 2, 0, 1, 2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
733 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
749 2, 0, -2, 2, 2, 0, -2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
751 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
767 1, 0, -2, 2, 1, 1, -2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
769 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
785 1, 1, -2, -2, 0, 0, 2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
787 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
803 1, 1, -2, -2, 0, 1, 2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
805 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
821 1, 1, -2, -2, 1, 0, -2, 2,
expected, __LINE__, SrcTopDown, DstTopDown);
823 if ((SrcTopDown || DstTopDown) && !(SrcTopDown && DstTopDown))
840 2, 2, -2, -2, 2, 2, -2, -2,
expected, __LINE__, SrcTopDown, DstTopDown);
855 trace(
"\n\n## Start of generalized StretchBlt tests.\n\n");
858 trace(
"\n\n## Start of source top-down and destination top-down tests.\n\n");
861 trace(
"\n\n## Start of source top-down and destination bottom-up tests.\n\n");
864 trace(
"\n\n## Start of source bottom-up and destination top-down tests.\n\n");
867 trace(
"\n\n## Start of source bottom-up and destination bottom-up tests.\n\n");
static int get_dib_stride(int width, int bpp)
static void test_StretchBlt_TopDownOptions(BOOL SrcTopDown, BOOL DstTopDown)
static void test_StretchBlt(void)
static void test_StretchBlt_stretch(HDC hdcDst, HDC hdcSrc, BITMAPINFO *dst_info, UINT32 *dstBuffer, UINT32 *srcBuffer, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, UINT32 *expected, int line, BOOL SrcTopDown, BOOL DstTopDown)
static int get_dib_image_size(const BITMAPINFO *info)
static void check_StretchBlt_stretch(HDC hdcDst, HDC hdcSrc, BITMAPINFO *dst_info, UINT32 *dstBuffer, UINT32 *srcBuffer, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, UINT32 *expected, int line)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
GLint GLint GLsizei width
#define memcpy(s1, s2, n)
BITMAPINFOHEADER bmiHeader
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
int WINAPI SetMapMode(_In_ HDC, _In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
UINT WINAPI SetDIBColorTable(_In_ HDC hdc, _In_ UINT iStart, _In_ UINT cEntries, _In_reads_(cEntries) const RGBQUAD *prgbq)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)