mirror of
https://github.com/reactos/reactos.git
synced 2024-08-23 11:52:51 +00:00
[GDI32_APITEST]
Add some more tests for MaskBlt svn path=/trunk/; revision=67047
This commit is contained in:
parent
9729094318
commit
4eebb1e0c9
|
@ -50,7 +50,7 @@ void Test_MaskBlt_1bpp()
|
||||||
pjBitsMsk[0] = 0xF0;
|
pjBitsMsk[0] = 0xF0;
|
||||||
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
||||||
ok (pjBitsDst[0] == 0xF0, "pjBitsDst[0] == 0x%x\n", pjBitsDst[0]);
|
ok(pjBitsDst[0] == 0xF0, "pjBitsDst[0] == 0x%x\n", pjBitsDst[0]);
|
||||||
|
|
||||||
/* Do the masking (NOTSRCERASE / SRCINVERT) */
|
/* Do the masking (NOTSRCERASE / SRCINVERT) */
|
||||||
pjBitsDst[0] = 0xF0; // 11110000
|
pjBitsDst[0] = 0xF0; // 11110000
|
||||||
|
@ -59,7 +59,7 @@ void Test_MaskBlt_1bpp()
|
||||||
|
|
||||||
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(NOTSRCERASE, SRCINVERT)); // 22
|
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(NOTSRCERASE, SRCINVERT)); // 22
|
||||||
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
||||||
ok (pjBitsDst[0] == 0x16, "pjBitsDst[0] == 0x%x\n", pjBitsDst[0]);
|
ok(pjBitsDst[0] == 0x16, "pjBitsDst[0] == 0x%x\n", pjBitsDst[0]);
|
||||||
|
|
||||||
/* Do the masking (MERGEPAINT / DSxn) */
|
/* Do the masking (MERGEPAINT / DSxn) */
|
||||||
pjBitsDst[0] = 0xF0;
|
pjBitsDst[0] = 0xF0;
|
||||||
|
@ -67,7 +67,7 @@ void Test_MaskBlt_1bpp()
|
||||||
pjBitsMsk[0] = 0xAA;
|
pjBitsMsk[0] = 0xAA;
|
||||||
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(MERGEPAINT, 0x990000));
|
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(MERGEPAINT, 0x990000));
|
||||||
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
||||||
ok (pjBitsDst[0] == 0xE3, "pjBitsDst[0] == 0x%x\n", pjBitsDst[0]);
|
ok(pjBitsDst[0] == 0xE3, "pjBitsDst[0] == 0x%x\n", pjBitsDst[0]);
|
||||||
|
|
||||||
/* Try a ROP that needs a mask with a NULL mask bitmap handle */
|
/* Try a ROP that needs a mask with a NULL mask bitmap handle */
|
||||||
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, NULL, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, NULL, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
|
@ -91,6 +91,26 @@ void Test_MaskBlt_1bpp()
|
||||||
ret = MaskBlt(hdcDst, 0, 0, 8, 1, NULL, 0, 0, NULL, 0, 0, MAKEROP4(PATCOPY, 0xAA0000));
|
ret = MaskBlt(hdcDst, 0, 0, 8, 1, NULL, 0, 0, NULL, 0, 0, MAKEROP4(PATCOPY, 0xAA0000));
|
||||||
ok(ret == 0, "MaskBlt should fail, but succeeded (%d)\n", ret);
|
ok(ret == 0, "MaskBlt should fail, but succeeded (%d)\n", ret);
|
||||||
|
|
||||||
|
|
||||||
|
/* Try with a mask that is smaller than the rect */
|
||||||
|
DeleteObject(hbmMsk);
|
||||||
|
pbmi->bmiHeader.biWidth = 4;
|
||||||
|
hbmMsk = CreateDIBSection(hdcDst, pbmi, DIB_RGB_COLORS, (PVOID*)&pjBitsMsk, NULL, 0);
|
||||||
|
|
||||||
|
/* Do the masking (SRCCOPY / NOOP) */
|
||||||
|
pjBitsDst[0] = 0xAA; // 10101010
|
||||||
|
pjBitsSrc[0] = 0xCC; // 11001100
|
||||||
|
pjBitsMsk[0] = 0x33; // 00110011
|
||||||
|
ret = MaskBlt(hdcDst, 0, 0, 5, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
|
ok(ret == 0, "MaskBlt should fail, but succeeded (%d)\n", ret);
|
||||||
|
ret = MaskBlt(hdcDst, 0, 0, 4, 1, hdcSrc, 0, 0, hbmMsk, 1, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
|
ok(ret == 0, "MaskBlt should fail, but succeeded (%d)\n", ret);
|
||||||
|
ret = MaskBlt(hdcDst, 0, 0, 4, 1, hdcSrc, 0, 0, hbmMsk, 0, 1, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
|
ok(ret == 0, "MaskBlt should fail, but succeeded (%d)\n", ret);
|
||||||
|
ret = MaskBlt(hdcDst, 0, 0, 4, 1, hdcSrc, 0, 0, hbmMsk, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
|
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
||||||
|
ok(pjBitsDst[0] == 0x8A, "pjBitsDst[0] == 0x%x\n", pjBitsDst[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test_MaskBlt_16bpp()
|
void Test_MaskBlt_16bpp()
|
||||||
|
@ -181,15 +201,66 @@ void Test_MaskBlt_32bpp()
|
||||||
ok (pulBitsDst[1] == 0xfabefef6, "pulBitsDst[0] == 0x%lx\n", pulBitsDst[1]);
|
ok (pulBitsDst[1] == 0xfabefef6, "pulBitsDst[0] == 0x%lx\n", pulBitsDst[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Test_MaskBlt_Brush()
|
||||||
|
{
|
||||||
|
HDC hdcDst, hdcSrc;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
BITMAPINFOHEADER bmiHeader;
|
||||||
|
ULONG aulColors[2];
|
||||||
|
} bmiData = {{sizeof(BITMAPINFOHEADER), 16, 16, 1, 1, BI_RGB, 0, 10, 10, 2,0}, {0, 0xFFFFFF}};
|
||||||
|
PBITMAPINFO pbmi = (PBITMAPINFO)&bmiData;
|
||||||
|
HBITMAP hbmDst, hbmSrc, hbmMsk;
|
||||||
|
PULONG pulBitsDst, pulBitsSrc, pulBitsMsk;
|
||||||
|
BOOL ret;
|
||||||
|
HBRUSH hbr;
|
||||||
|
|
||||||
|
/* Create a dest dc and bitmap */
|
||||||
|
hdcDst = CreateCompatibleDC(NULL);
|
||||||
|
hbmDst = CreateDIBSection(hdcDst, pbmi, DIB_RGB_COLORS, (PVOID*)&pulBitsDst, NULL, 0);
|
||||||
|
SelectObject(hdcDst, hbmDst);
|
||||||
|
|
||||||
|
/* Create a source dc and bitmap */
|
||||||
|
hdcSrc = CreateCompatibleDC(NULL);
|
||||||
|
hbmSrc = CreateDIBSection(hdcSrc, pbmi, DIB_RGB_COLORS, (PVOID*)&pulBitsSrc, NULL, 0);
|
||||||
|
SelectObject(hdcSrc, hbmSrc);
|
||||||
|
|
||||||
|
hbr = CreateHatchBrush(HS_CROSS, 0);
|
||||||
|
ok(hbr != 0, "failed to create brush\n");
|
||||||
|
ok(SelectObject(hdcDst, hbr) != 0, "failed to select brush\n");
|
||||||
|
|
||||||
|
/* Do the masking (SRCCOPY / NOOP) */
|
||||||
|
pulBitsDst[0] = 0x00000000;
|
||||||
|
pulBitsSrc[0] = 0xFFFFFFFF;
|
||||||
|
ret = MaskBlt(hdcDst, 0, 0, 8, 1, hdcSrc, 0, 0, NULL, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
|
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
||||||
|
ok(pulBitsDst[0] == 0, "pulBitsDst[0] == 0x%lx\n", pulBitsDst[0]);
|
||||||
|
|
||||||
|
/* Create a 1 bpp pattern brush */
|
||||||
|
pbmi->bmiHeader.biWidth = 8;
|
||||||
|
hbmMsk = CreateDIBSection(hdcDst, pbmi, DIB_RGB_COLORS, (PVOID*)&pulBitsMsk, NULL, 0);
|
||||||
|
ok(hbmMsk != 0, "CreateDIBSection failed\n");
|
||||||
|
hbr = CreatePatternBrush(hbmMsk);
|
||||||
|
ok(hbr != 0, "CreatePatternBrush failed\n");
|
||||||
|
ok(SelectObject(hdcDst, hbr) != 0, "failed to select brush\n");
|
||||||
|
|
||||||
|
/* Do the masking (SRCCOPY / NOOP) */
|
||||||
|
pulBitsDst[0] = 0x00000000;
|
||||||
|
pulBitsSrc[0] = 0xFFFFFFFF;
|
||||||
|
pulBitsMsk[0] = 0xCCAAFF00;
|
||||||
|
ret = MaskBlt(hdcDst, 0, 0, 16, 1, hdcSrc, 0, 0, NULL, 0, 0, MAKEROP4(SRCCOPY, 0xAA0000));
|
||||||
|
ok(ret == 1, "MaskBlt failed (%d)\n", ret);
|
||||||
|
ok(pulBitsDst[0] == 0, "pulBitsDst[0] == 0x%lx\n", pulBitsDst[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(MaskBlt)
|
START_TEST(MaskBlt)
|
||||||
{
|
{
|
||||||
InitStuff();
|
InitStuff();
|
||||||
Test_MaskBlt_1bpp();
|
Test_MaskBlt_1bpp();
|
||||||
switch (GetDeviceCaps(GetDC(NULL), BITSPIXEL))
|
Test_MaskBlt_16bpp();
|
||||||
{
|
Test_MaskBlt_32bpp();
|
||||||
case 16: Test_MaskBlt_16bpp(); break;
|
Test_MaskBlt_Brush();
|
||||||
case 32: Test_MaskBlt_32bpp(); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue