3 Test_NtGdiBitBlt(PTESTINFO pti
)
7 HBITMAP hbmp1
, hOldBmp1
, hbmp2
, hOldBmp2
;
8 DWORD bytes1
[4] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff};
9 DWORD bytes2
[4] = {0x00000000, 0x0000000, 0x0000000, 0x00000000};
12 SetLastError(ERROR_SUCCESS
);
13 bRet
= NtGdiBitBlt((HDC
)0, 0, 0, 10, 10, (HDC
)0, 10, 10, SRCCOPY
, 0, 0);
15 TEST(GetLastError() == ERROR_SUCCESS
);
18 SetLastError(ERROR_SUCCESS
);
19 bRet
= NtGdiBitBlt((HDC
)0x123456, 0, 0, 10, 10, (HDC
)0x123456, 10, 10, SRCCOPY
, 0, 0);
21 TEST(GetLastError() == ERROR_SUCCESS
);
23 hdc1
= NtGdiCreateCompatibleDC(0);
26 hdc2
= NtGdiCreateCompatibleDC(0);
29 hbmp1
= NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE
)bytes1
);
31 hOldBmp1
= SelectObject(hdc1
, hbmp1
);
33 TESTX(NtGdiGetPixel(hdc1
, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 0));
34 TESTX(NtGdiGetPixel(hdc1
, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 1));
35 TESTX(NtGdiGetPixel(hdc1
, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 0));
36 TESTX(NtGdiGetPixel(hdc1
, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 1));
38 hbmp2
= NtGdiCreateBitmap(2, 2, 1, 32, (LPBYTE
)bytes2
);
40 hOldBmp2
= SelectObject(hdc2
, hbmp2
);
42 bRet
= NtGdiBitBlt(hdc2
, 1, 1, -2, -2, hdc1
, 0, 0, SRCCOPY
, 0, 0);
44 TEST(GetLastError() == ERROR_SUCCESS
);
45 TESTX(NtGdiGetPixel(hdc2
, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 0));
46 TESTX(NtGdiGetPixel(hdc2
, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 1));
47 TESTX(NtGdiGetPixel(hdc2
, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 0));
48 TESTX(NtGdiGetPixel(hdc2
, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 1));
50 bRet
= NtGdiBitBlt(hdc2
, 1, 1, -2, -2, hdc1
, 1, 1, SRCCOPY
, 0, 0);
52 TEST(GetLastError() == ERROR_SUCCESS
);
53 TESTX(NtGdiGetPixel(hdc2
, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 0));
54 TESTX(NtGdiGetPixel(hdc2
, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 1));
55 TESTX(NtGdiGetPixel(hdc2
, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 0));
56 TESTX(NtGdiGetPixel(hdc2
, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 1));
58 NtGdiSetPixel(hdc2
, 0, 0, 0x00000000);
60 bRet
= NtGdiBitBlt(hdc2
, 1, 1, -2, -2, hdc1
, 0, 0, SRCCOPY
, 0, 0);
62 TEST(GetLastError() == ERROR_SUCCESS
);
63 TESTX(NtGdiGetPixel(hdc2
, 0, 0) == 0x00000000, "Pixel[0][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 0));
64 TESTX(NtGdiGetPixel(hdc2
, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 1));
65 TESTX(NtGdiGetPixel(hdc2
, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 0));
66 TESTX(NtGdiGetPixel(hdc2
, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 1));
68 bRet
= NtGdiBitBlt(hdc2
, 1, 1, -2, -2, hdc1
, 2, 2, SRCCOPY
, 0, 0);
70 TEST(GetLastError() == ERROR_SUCCESS
);
71 TESTX(NtGdiGetPixel(hdc2
, 0, 0) == 0x00ffffff, "Pixel[0][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 0));
72 TESTX(NtGdiGetPixel(hdc2
, 0, 1) == 0x00000000, "Pixel[0][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 1));
73 TESTX(NtGdiGetPixel(hdc2
, 1, 0) == 0x00000000, "Pixel[1][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 0));
74 TESTX(NtGdiGetPixel(hdc2
, 1, 1) == 0x00000000, "Pixel[1][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 1));
76 NtGdiSetPixel(hdc2
, 0, 0, 0x00000000);
78 bRet
= NtGdiBitBlt(hdc2
, 2, 2, -2, -2, hdc1
, 2, 2, SRCCOPY
, 0, 0);
80 TEST(GetLastError() == ERROR_SUCCESS
);
81 TESTX(NtGdiGetPixel(hdc2
, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 0));
82 TESTX(NtGdiGetPixel(hdc2
, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 1));
83 TESTX(NtGdiGetPixel(hdc2
, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 0));
84 TESTX(NtGdiGetPixel(hdc2
, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 1));
86 NtGdiSetPixel(hdc2
, 0, 0, 0x00000000);
87 NtGdiSetPixel(hdc2
, 1, 0, 0x00000000);
88 NtGdiSetPixel(hdc2
, 0, 1, 0x00000000);
89 NtGdiSetPixel(hdc2
, 1, 1, 0x00000000);
91 bRet
= NtGdiBitBlt(hdc2
, 0, 0, 2, 2, hdc1
, 0, 0, SRCCOPY
, 0, 0);
93 TEST(GetLastError() == ERROR_SUCCESS
);
94 TESTX(NtGdiGetPixel(hdc2
, 0, 0) == 0x000000ff, "Pixel[0][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 0));
95 TESTX(NtGdiGetPixel(hdc2
, 0, 1) == 0x00ff0000, "Pixel[0][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 0, 1));
96 TESTX(NtGdiGetPixel(hdc2
, 1, 0) == 0x0000ff00, "Pixel[1][0] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 0));
97 TESTX(NtGdiGetPixel(hdc2
, 1, 1) == 0x00ffffff, "Pixel[1][1] 0x%08x\n", (UINT
)NtGdiGetPixel(hdc2
, 1, 1));
99 SelectObject(hdc2
, hOldBmp2
);
100 SelectObject(hdc1
, hOldBmp1
);
108 return APISTATUS_NORMAL
;