ddraw/tests: Test P8 color keying.
Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
156a2aa07a
commit
ab34bc6cca
|
@ -5323,18 +5323,21 @@ static void test_palette_complex(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_p8_rgb_blit(void)
|
||||
static void test_p8_blit(void)
|
||||
{
|
||||
IDirectDrawSurface *src, *dst;
|
||||
IDirectDrawSurface *src, *dst, *dst_p8;
|
||||
DDSURFACEDESC surface_desc;
|
||||
IDirectDraw *ddraw;
|
||||
IDirectDrawPalette *palette;
|
||||
IDirectDrawPalette *palette, *palette2;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
PALETTEENTRY palette_entries[256];
|
||||
unsigned int x;
|
||||
DDBLTFX fx;
|
||||
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
|
||||
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const D3DCOLOR expected[] =
|
||||
{
|
||||
0x00101010, 0x00010101, 0x00020202, 0x00030303,
|
||||
|
@ -5357,6 +5360,13 @@ static void test_p8_rgb_blit(void)
|
|||
hr = IDirectDraw_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
palette_entries[1].peBlue = 0xff;
|
||||
palette_entries[2].peGreen = 0xff;
|
||||
palette_entries[3].peRed = 0xff;
|
||||
palette_entries[4].peFlags = 0x0;
|
||||
hr = IDirectDraw_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette2, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -5369,6 +5379,10 @@ static void test_p8_rgb_blit(void)
|
|||
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 8;
|
||||
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface_SetPalette(dst_p8, palette2);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -5388,12 +5402,18 @@ static void test_p8_rgb_blit(void)
|
|||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
hr = IDirectDrawSurface_Lock(src, NULL, &surface_desc, 0, NULL);
|
||||
hr = IDirectDrawSurface_Lock(src, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock source surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data, sizeof(src_data));
|
||||
hr = IDirectDrawSurface_Unlock(src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock source surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data2, sizeof(src_data2));
|
||||
hr = IDirectDrawSurface_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_SetPalette(src, palette);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface_Blt(dst, NULL, src, NULL, DDBLT_WAIT, NULL);
|
||||
|
@ -5413,9 +5433,25 @@ static void test_p8_rgb_blit(void)
|
|||
}
|
||||
}
|
||||
|
||||
memset(&fx, 0, sizeof(fx));
|
||||
fx.dwSize = sizeof(fx);
|
||||
fx.ddckSrcColorkey.dwColorSpaceHighValue = 0x2;
|
||||
fx.ddckSrcColorkey.dwColorSpaceLowValue = 0x2;
|
||||
hr = IDirectDrawSurface_Blt(dst_p8, NULL, src, NULL, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &fx);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)),
|
||||
"Got unexpected P8 color key blit result.\n");
|
||||
hr = IDirectDrawSurface_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
IDirectDrawSurface_Release(src);
|
||||
IDirectDrawSurface_Release(dst);
|
||||
IDirectDrawSurface_Release(dst_p8);
|
||||
IDirectDrawPalette_Release(palette);
|
||||
IDirectDrawPalette_Release(palette2);
|
||||
|
||||
refcount = IDirectDraw_Release(ddraw);
|
||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||
|
@ -9056,7 +9092,7 @@ START_TEST(ddraw1)
|
|||
test_create_surface_pitch();
|
||||
test_mipmap();
|
||||
test_palette_complex();
|
||||
test_p8_rgb_blit();
|
||||
test_p8_blit();
|
||||
test_material();
|
||||
test_lighting();
|
||||
test_palette_gdi();
|
||||
|
|
|
@ -6383,18 +6383,21 @@ static void test_palette_complex(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_p8_rgb_blit(void)
|
||||
static void test_p8_blit(void)
|
||||
{
|
||||
IDirectDrawSurface *src, *dst;
|
||||
IDirectDrawSurface *src, *dst, *dst_p8;
|
||||
DDSURFACEDESC surface_desc;
|
||||
IDirectDraw2 *ddraw;
|
||||
IDirectDrawPalette *palette;
|
||||
IDirectDrawPalette *palette, *palette2;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
PALETTEENTRY palette_entries[256];
|
||||
unsigned int x;
|
||||
DDBLTFX fx;
|
||||
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
|
||||
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const D3DCOLOR expected[] =
|
||||
{
|
||||
0x00101010, 0x00010101, 0x00020202, 0x00030303,
|
||||
|
@ -6417,6 +6420,13 @@ static void test_p8_rgb_blit(void)
|
|||
hr = IDirectDraw2_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
palette_entries[1].peBlue = 0xff;
|
||||
palette_entries[2].peGreen = 0xff;
|
||||
palette_entries[3].peRed = 0xff;
|
||||
palette_entries[4].peFlags = 0x0;
|
||||
hr = IDirectDraw2_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette2, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -6429,6 +6439,10 @@ static void test_p8_rgb_blit(void)
|
|||
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 8;
|
||||
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface_SetPalette(dst_p8, palette2);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -6448,12 +6462,18 @@ static void test_p8_rgb_blit(void)
|
|||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
hr = IDirectDrawSurface_Lock(src, NULL, &surface_desc, 0, NULL);
|
||||
hr = IDirectDrawSurface_Lock(src, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock source surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data, sizeof(src_data));
|
||||
hr = IDirectDrawSurface_Unlock(src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock source surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data2, sizeof(src_data2));
|
||||
hr = IDirectDrawSurface_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_SetPalette(src, palette);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface_Blt(dst, NULL, src, NULL, DDBLT_WAIT, NULL);
|
||||
|
@ -6473,9 +6493,25 @@ static void test_p8_rgb_blit(void)
|
|||
}
|
||||
}
|
||||
|
||||
memset(&fx, 0, sizeof(fx));
|
||||
fx.dwSize = sizeof(fx);
|
||||
fx.ddckSrcColorkey.dwColorSpaceHighValue = 0x2;
|
||||
fx.ddckSrcColorkey.dwColorSpaceLowValue = 0x2;
|
||||
hr = IDirectDrawSurface7_Blt(dst_p8, NULL, src, NULL, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &fx);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)),
|
||||
"Got unexpected P8 color key blit result.\n");
|
||||
hr = IDirectDrawSurface_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
IDirectDrawSurface_Release(src);
|
||||
IDirectDrawSurface_Release(dst);
|
||||
IDirectDrawSurface_Release(dst_p8);
|
||||
IDirectDrawPalette_Release(palette);
|
||||
IDirectDrawPalette_Release(palette2);
|
||||
|
||||
refcount = IDirectDraw2_Release(ddraw);
|
||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||
|
@ -10238,7 +10274,7 @@ START_TEST(ddraw2)
|
|||
test_create_surface_pitch();
|
||||
test_mipmap();
|
||||
test_palette_complex();
|
||||
test_p8_rgb_blit();
|
||||
test_p8_blit();
|
||||
test_material();
|
||||
test_lighting();
|
||||
test_specular_lighting();
|
||||
|
|
|
@ -7910,18 +7910,21 @@ static void test_palette_complex(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_p8_rgb_blit(void)
|
||||
static void test_p8_blit(void)
|
||||
{
|
||||
IDirectDrawSurface4 *src, *dst;
|
||||
IDirectDrawSurface4 *src, *dst, *dst_p8;
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
IDirectDraw4 *ddraw;
|
||||
IDirectDrawPalette *palette;
|
||||
IDirectDrawPalette *palette, *palette2;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
PALETTEENTRY palette_entries[256];
|
||||
unsigned int x;
|
||||
DDBLTFX fx;
|
||||
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
|
||||
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const D3DCOLOR expected[] =
|
||||
{
|
||||
0x00101010, 0x00010101, 0x00020202, 0x00030303,
|
||||
|
@ -7944,6 +7947,13 @@ static void test_p8_rgb_blit(void)
|
|||
hr = IDirectDraw4_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
palette_entries[1].peBlue = 0xff;
|
||||
palette_entries[2].peGreen = 0xff;
|
||||
palette_entries[3].peRed = 0xff;
|
||||
palette_entries[4].peFlags = 0x0;
|
||||
hr = IDirectDraw4_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette2, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -7956,6 +7966,10 @@ static void test_p8_rgb_blit(void)
|
|||
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 8;
|
||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface4_SetPalette(dst_p8, palette2);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -7975,12 +7989,18 @@ static void test_p8_rgb_blit(void)
|
|||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
hr = IDirectDrawSurface4_Lock(src, NULL, &surface_desc, 0, NULL);
|
||||
hr = IDirectDrawSurface4_Lock(src, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock source surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data, sizeof(src_data));
|
||||
hr = IDirectDrawSurface4_Unlock(src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock source surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface4_Lock(dst_p8, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data2, sizeof(src_data2));
|
||||
hr = IDirectDrawSurface4_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface4_SetPalette(src, palette);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface4_Blt(dst, NULL, src, NULL, DDBLT_WAIT, NULL);
|
||||
|
@ -8000,9 +8020,25 @@ static void test_p8_rgb_blit(void)
|
|||
}
|
||||
}
|
||||
|
||||
memset(&fx, 0, sizeof(fx));
|
||||
fx.dwSize = sizeof(fx);
|
||||
fx.ddckSrcColorkey.dwColorSpaceHighValue = 0x2;
|
||||
fx.ddckSrcColorkey.dwColorSpaceLowValue = 0x2;
|
||||
hr = IDirectDrawSurface4_Blt(dst_p8, NULL, src, NULL, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &fx);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface4_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)),
|
||||
"Got unexpected P8 color key blit result.\n");
|
||||
hr = IDirectDrawSurface4_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
IDirectDrawSurface4_Release(src);
|
||||
IDirectDrawSurface4_Release(dst);
|
||||
IDirectDrawSurface4_Release(dst_p8);
|
||||
IDirectDrawPalette_Release(palette);
|
||||
IDirectDrawPalette_Release(palette2);
|
||||
|
||||
refcount = IDirectDraw4_Release(ddraw);
|
||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||
|
@ -11570,7 +11606,7 @@ START_TEST(ddraw4)
|
|||
test_create_surface_pitch();
|
||||
test_mipmap();
|
||||
test_palette_complex();
|
||||
test_p8_rgb_blit();
|
||||
test_p8_blit();
|
||||
test_material();
|
||||
test_palette_gdi();
|
||||
test_palette_alpha();
|
||||
|
|
|
@ -7822,18 +7822,21 @@ static void test_palette_complex(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_p8_rgb_blit(void)
|
||||
static void test_p8_blit(void)
|
||||
{
|
||||
IDirectDrawSurface7 *src, *dst;
|
||||
IDirectDrawSurface7 *src, *dst, *dst_p8;
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
IDirectDraw7 *ddraw;
|
||||
IDirectDrawPalette *palette;
|
||||
IDirectDrawPalette *palette, *palette2;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
PALETTEENTRY palette_entries[256];
|
||||
unsigned int x;
|
||||
DDBLTFX fx;
|
||||
static const BYTE src_data[] = {0x10, 0x1, 0x2, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const BYTE src_data2[] = {0x10, 0x5, 0x4, 0x3, 0x2, 0x1, 0xff, 0x80};
|
||||
static const BYTE expected_p8[] = {0x10, 0x1, 0x4, 0x3, 0x4, 0x5, 0xff, 0x80};
|
||||
static const D3DCOLOR expected[] =
|
||||
{
|
||||
0x00101010, 0x00010101, 0x00020202, 0x00030303,
|
||||
|
@ -7856,6 +7859,13 @@ static void test_p8_rgb_blit(void)
|
|||
hr = IDirectDraw7_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
palette_entries[1].peBlue = 0xff;
|
||||
palette_entries[2].peGreen = 0xff;
|
||||
palette_entries[3].peRed = 0xff;
|
||||
palette_entries[4].peFlags = 0x0;
|
||||
hr = IDirectDraw7_CreatePalette(ddraw, DDPCAPS_8BIT | DDPCAPS_ALLOW256,
|
||||
palette_entries, &palette2, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -7868,6 +7878,10 @@ static void test_p8_rgb_blit(void)
|
|||
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 8;
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface7_SetPalette(dst_p8, palette2);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
|
@ -7887,12 +7901,18 @@ static void test_p8_rgb_blit(void)
|
|||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
hr = IDirectDrawSurface7_Lock(src, NULL, &surface_desc, 0, NULL);
|
||||
hr = IDirectDrawSurface7_Lock(src, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock source surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data, sizeof(src_data));
|
||||
hr = IDirectDrawSurface7_Unlock(src, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock source surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface7_Lock(dst_p8, NULL, &surface_desc, DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
memcpy(surface_desc.lpSurface, src_data2, sizeof(src_data2));
|
||||
hr = IDirectDrawSurface7_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface7_SetPalette(src, palette);
|
||||
ok(SUCCEEDED(hr), "Failed to set palette, hr %#x.\n", hr);
|
||||
hr = IDirectDrawSurface7_Blt(dst, NULL, src, NULL, DDBLT_WAIT, NULL);
|
||||
|
@ -7912,9 +7932,25 @@ static void test_p8_rgb_blit(void)
|
|||
}
|
||||
}
|
||||
|
||||
memset(&fx, 0, sizeof(fx));
|
||||
fx.dwSize = sizeof(fx);
|
||||
fx.ddckSrcColorkey.dwColorSpaceHighValue = 0x2;
|
||||
fx.ddckSrcColorkey.dwColorSpaceLowValue = 0x2;
|
||||
hr = IDirectDrawSurface7_Blt(dst_p8, NULL, src, NULL, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &fx);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface7_Lock(dst_p8, NULL, &surface_desc, DDLOCK_READONLY | DDLOCK_WAIT, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to lock destination surface, hr %#x.\n", hr);
|
||||
ok(!memcmp(surface_desc.lpSurface, expected_p8, sizeof(expected_p8)),
|
||||
"Got unexpected P8 color key blit result.\n");
|
||||
hr = IDirectDrawSurface7_Unlock(dst_p8, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to unlock destination surface, hr %#x.\n", hr);
|
||||
|
||||
IDirectDrawSurface7_Release(src);
|
||||
IDirectDrawSurface7_Release(dst);
|
||||
IDirectDrawSurface7_Release(dst_p8);
|
||||
IDirectDrawPalette_Release(palette);
|
||||
IDirectDrawPalette_Release(palette2);
|
||||
|
||||
refcount = IDirectDraw7_Release(ddraw);
|
||||
ok(!refcount, "Got unexpected refcount %u.\n", refcount);
|
||||
|
@ -11894,7 +11930,7 @@ START_TEST(ddraw7)
|
|||
test_create_surface_pitch();
|
||||
test_mipmap();
|
||||
test_palette_complex();
|
||||
test_p8_rgb_blit();
|
||||
test_p8_blit();
|
||||
test_material();
|
||||
test_palette_gdi();
|
||||
test_palette_alpha();
|
||||
|
|
Loading…
Reference in New Issue