ddraw/tests: Rewrite blt_test().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
329dfee70c
commit
f0c7c7f627
|
@ -8497,6 +8497,86 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_blt(void)
|
||||
{
|
||||
IDirectDrawSurface *surface, *rt;
|
||||
DDSURFACEDESC surface_desc;
|
||||
IDirect3DDevice *device;
|
||||
IDirectDraw *ddraw;
|
||||
unsigned int i;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
static struct
|
||||
{
|
||||
RECT src_rect;
|
||||
RECT dst_rect;
|
||||
HRESULT hr;
|
||||
}
|
||||
test_data[] =
|
||||
{
|
||||
{{160, 0, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit. */
|
||||
{{160, 480, 640, 0}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, flipped source. */
|
||||
{{640, 0, 160, 480}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, mirrored source. */
|
||||
{{160, 0, 480, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched x. */
|
||||
{{160, 160, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched y. */
|
||||
{{ 0, 0, 640, 480}, { 0, 0, 640, 480}, DD_OK}, /* Full surface blit. */
|
||||
{{ 0, 0, 640, 480}, { 0, 480, 640, 0}, DDERR_INVALIDRECT}, /* Full surface, flipped destination. */
|
||||
{{ 0, 0, 640, 480}, {640, 0, 0, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored destination. */
|
||||
{{ 0, 480, 640, 0}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, flipped source. */
|
||||
{{640, 0, 0, 480}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored source. */
|
||||
};
|
||||
|
||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 640, 480, 0, 0, 0, 0);
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
IDirectDraw_Release(ddraw);
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, surface, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, rt, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
{
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
surface, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
rt, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
}
|
||||
|
||||
IDirectDrawSurface_Release(surface);
|
||||
IDirectDrawSurface_Release(rt);
|
||||
refcount = IDirect3DDevice_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
IDirectDraw_Release(ddraw);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw1)
|
||||
{
|
||||
IDirectDraw *ddraw;
|
||||
|
@ -8573,4 +8653,5 @@ START_TEST(ddraw1)
|
|||
test_yv12_overlay();
|
||||
test_offscreen_overlay();
|
||||
test_overlay_rect();
|
||||
test_blt();
|
||||
}
|
||||
|
|
|
@ -9604,6 +9604,86 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_blt(void)
|
||||
{
|
||||
IDirectDrawSurface *surface, *rt;
|
||||
DDSURFACEDESC surface_desc;
|
||||
IDirect3DDevice2 *device;
|
||||
IDirectDraw2 *ddraw;
|
||||
unsigned int i;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
static struct
|
||||
{
|
||||
RECT src_rect;
|
||||
RECT dst_rect;
|
||||
HRESULT hr;
|
||||
}
|
||||
test_data[] =
|
||||
{
|
||||
{{160, 0, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit. */
|
||||
{{160, 480, 640, 0}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, flipped source. */
|
||||
{{640, 0, 160, 480}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, mirrored source. */
|
||||
{{160, 0, 480, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched x. */
|
||||
{{160, 160, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched y. */
|
||||
{{ 0, 0, 640, 480}, { 0, 0, 640, 480}, DD_OK}, /* Full surface blit. */
|
||||
{{ 0, 0, 640, 480}, { 0, 480, 640, 0}, DDERR_INVALIDRECT}, /* Full surface, flipped destination. */
|
||||
{{ 0, 0, 640, 480}, {640, 0, 0, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored destination. */
|
||||
{{ 0, 480, 640, 0}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, flipped source. */
|
||||
{{640, 0, 0, 480}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored source. */
|
||||
};
|
||||
|
||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 640, 480, 0, 0, 0, 0);
|
||||
ddraw = create_ddraw();
|
||||
ok(!!ddraw, "Failed to create a ddraw object.\n");
|
||||
if (!(device = create_device(ddraw, window, DDSCL_NORMAL)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
IDirectDraw2_Release(ddraw);
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice2_GetRenderTarget(device, &rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, surface, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, rt, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
{
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
surface, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
rt, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
}
|
||||
|
||||
IDirectDrawSurface_Release(surface);
|
||||
IDirectDrawSurface_Release(rt);
|
||||
refcount = IDirect3DDevice2_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
IDirectDraw2_Release(ddraw);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw2)
|
||||
{
|
||||
IDirectDraw2 *ddraw;
|
||||
|
@ -9687,4 +9767,5 @@ START_TEST(ddraw2)
|
|||
test_yv12_overlay();
|
||||
test_offscreen_overlay();
|
||||
test_overlay_rect();
|
||||
test_blt();
|
||||
}
|
||||
|
|
|
@ -10775,6 +10775,89 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_blt(void)
|
||||
{
|
||||
IDirectDrawSurface4 *surface, *rt;
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
IDirect3DDevice3 *device;
|
||||
IDirectDraw4 *ddraw;
|
||||
IDirect3D3 *d3d;
|
||||
unsigned int i;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
static struct
|
||||
{
|
||||
RECT src_rect;
|
||||
RECT dst_rect;
|
||||
HRESULT hr;
|
||||
}
|
||||
test_data[] =
|
||||
{
|
||||
{{160, 0, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit. */
|
||||
{{160, 480, 640, 0}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, flipped source. */
|
||||
{{640, 0, 160, 480}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, mirrored source. */
|
||||
{{160, 0, 480, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched x. */
|
||||
{{160, 160, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched y. */
|
||||
{{ 0, 0, 640, 480}, { 0, 0, 640, 480}, DD_OK}, /* Full surface blit. */
|
||||
{{ 0, 0, 640, 480}, { 0, 480, 640, 0}, DDERR_INVALIDRECT}, /* Full surface, flipped destination. */
|
||||
{{ 0, 0, 640, 480}, {640, 0, 0, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored destination. */
|
||||
{{ 0, 480, 640, 0}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, flipped source. */
|
||||
{{640, 0, 0, 480}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored source. */
|
||||
};
|
||||
|
||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 640, 480, 0, 0, 0, 0);
|
||||
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice3_GetDirect3D(device, &d3d);
|
||||
ok(SUCCEEDED(hr), "Failed to get Direct3D3 interface, hr %#x.\n", hr);
|
||||
hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw);
|
||||
ok(SUCCEEDED(hr), "Failed to get DirectDraw4 interface, hr %#x.\n", hr);
|
||||
IDirect3D3_Release(d3d);
|
||||
hr = IDirect3DDevice3_GetRenderTarget(device, &rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, surface, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, rt, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
{
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
surface, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
rt, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
}
|
||||
|
||||
IDirectDrawSurface4_Release(surface);
|
||||
IDirectDrawSurface4_Release(rt);
|
||||
IDirectDraw4_Release(ddraw);
|
||||
refcount = IDirect3DDevice3_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw4)
|
||||
{
|
||||
IDirectDraw4 *ddraw;
|
||||
|
@ -10865,4 +10948,5 @@ START_TEST(ddraw4)
|
|||
test_yv12_overlay();
|
||||
test_offscreen_overlay();
|
||||
test_overlay_rect();
|
||||
test_blt();
|
||||
}
|
||||
|
|
|
@ -11048,6 +11048,89 @@ done:
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_blt(void)
|
||||
{
|
||||
IDirectDrawSurface7 *surface, *rt;
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
IDirect3DDevice7 *device;
|
||||
IDirectDraw7 *ddraw;
|
||||
IDirect3D7 *d3d;
|
||||
unsigned int i;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
static struct
|
||||
{
|
||||
RECT src_rect;
|
||||
RECT dst_rect;
|
||||
HRESULT hr;
|
||||
}
|
||||
test_data[] =
|
||||
{
|
||||
{{160, 0, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit. */
|
||||
{{160, 480, 640, 0}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, flipped source. */
|
||||
{{640, 0, 160, 480}, { 0, 0, 480, 480}, DDERR_INVALIDRECT}, /* Overlapped blit, mirrored source. */
|
||||
{{160, 0, 480, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched x. */
|
||||
{{160, 160, 640, 480}, { 0, 0, 480, 480}, DD_OK}, /* Overlapped blit, stretched y. */
|
||||
{{ 0, 0, 640, 480}, { 0, 0, 640, 480}, DD_OK}, /* Full surface blit. */
|
||||
{{ 0, 0, 640, 480}, { 0, 480, 640, 0}, DDERR_INVALIDRECT}, /* Full surface, flipped destination. */
|
||||
{{ 0, 0, 640, 480}, {640, 0, 0, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored destination. */
|
||||
{{ 0, 480, 640, 0}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, flipped source. */
|
||||
{{640, 0, 0, 480}, { 0, 0, 640, 480}, DDERR_INVALIDRECT}, /* Full surface, mirrored source. */
|
||||
};
|
||||
|
||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 640, 480, 0, 0, 0, 0);
|
||||
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||
{
|
||||
skip("Failed to create a 3D device, skipping test.\n");
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice7_GetDirect3D(device, &d3d);
|
||||
ok(SUCCEEDED(hr), "Failed to get Direct3D7 interface, hr %#x.\n", hr);
|
||||
hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw);
|
||||
ok(SUCCEEDED(hr), "Failed to get DirectDraw7 interface, hr %#x.\n", hr);
|
||||
IDirect3D7_Release(d3d);
|
||||
hr = IDirect3DDevice7_GetRenderTarget(device, &rt);
|
||||
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, surface, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, NULL, rt, NULL, 0, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to blit, hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
|
||||
{
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
surface, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
|
||||
hr = IDirectDrawSurface_Blt(surface, &test_data[i].dst_rect,
|
||||
rt, &test_data[i].src_rect, DDBLT_WAIT, NULL);
|
||||
ok(hr == test_data[i].hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
}
|
||||
|
||||
IDirectDrawSurface7_Release(surface);
|
||||
IDirectDrawSurface7_Release(rt);
|
||||
IDirectDraw7_Release(ddraw);
|
||||
refcount = IDirect3DDevice7_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw7)
|
||||
{
|
||||
HMODULE module = GetModuleHandleA("ddraw.dll");
|
||||
|
@ -11149,4 +11232,5 @@ START_TEST(ddraw7)
|
|||
test_yv12_overlay();
|
||||
test_offscreen_overlay();
|
||||
test_overlay_rect();
|
||||
test_blt();
|
||||
}
|
||||
|
|
|
@ -582,113 +582,6 @@ static void fog_test(IDirect3DDevice7 *device)
|
|||
ok(hr == D3D_OK, "Turning off fog calculations returned %08x\n", hr);
|
||||
}
|
||||
|
||||
static void blt_test(IDirect3DDevice7 *device)
|
||||
{
|
||||
IDirectDrawSurface7 *backbuffer = NULL, *offscreen = NULL;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT hr;
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
|
||||
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
ddsd.dwWidth = 640;
|
||||
ddsd.dwHeight = 480;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE;
|
||||
hr = IDirectDraw7_CreateSurface(DirectDraw, &ddsd, &offscreen, NULL);
|
||||
ok(hr == D3D_OK, "Creating the offscreen render target failed, hr = %08x\n", hr);
|
||||
|
||||
/* Offscreen blits with the same source as destination */
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
RECT src_rect, dst_rect;
|
||||
|
||||
/* Blit the whole surface to itself */
|
||||
hr = IDirectDrawSurface_Blt(offscreen, NULL, offscreen, NULL, 0, NULL);
|
||||
ok(hr == DD_OK, "IDirectDrawSurface7_Blt returned %08x\n", hr);
|
||||
|
||||
/* Overlapped blit */
|
||||
dst_rect.left = 0; dst_rect.right = 480;
|
||||
dst_rect.top = 0; dst_rect.bottom = 480;
|
||||
src_rect.left = 160; src_rect.right = 640;
|
||||
src_rect.top = 0; src_rect.bottom = 480;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, offscreen, &src_rect, 0, NULL);
|
||||
ok(hr == DD_OK, "IDirectDrawSurface7_Blt returned %08x\n", hr);
|
||||
|
||||
/* Overlapped blit, flip-y through source rectangle (not allowed) */
|
||||
dst_rect.left = 0; dst_rect.right = 480;
|
||||
dst_rect.top = 0; dst_rect.bottom = 480;
|
||||
src_rect.left = 160; src_rect.right = 640;
|
||||
src_rect.top = 480; src_rect.bottom = 0;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, offscreen, &src_rect, 0, NULL);
|
||||
ok(hr == DDERR_INVALIDRECT, "IDirectDrawSurface7_Blt returned %08x\n", hr);
|
||||
|
||||
/* Overlapped blit, with shrinking in x */
|
||||
dst_rect.left = 0; dst_rect.right = 480;
|
||||
dst_rect.top = 0; dst_rect.bottom = 480;
|
||||
src_rect.left = 160; src_rect.right = 480;
|
||||
src_rect.top = 0; src_rect.bottom = 480;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, offscreen, &src_rect, 0, NULL);
|
||||
ok(hr == DD_OK, "IDirectDrawSurface7_Blt returned %08x\n", hr);
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice7_GetRenderTarget(device, &backbuffer);
|
||||
ok(hr == D3D_OK, "Unable to obtain a surface pointer to the backbuffer, hr = %08x\n", hr);
|
||||
|
||||
/* backbuffer ==> texture blits */
|
||||
if(SUCCEEDED(hr) && offscreen)
|
||||
{
|
||||
RECT src_rect, dst_rect;
|
||||
|
||||
/* backbuffer ==> texture, src_rect=NULL, dst_rect=NULL, no scaling */
|
||||
hr = IDirectDrawSurface_Blt(offscreen, NULL, backbuffer, NULL, 0, NULL);
|
||||
ok(hr == DD_OK, "fullscreen Blt from backbuffer => texture failed with hr = %08x\n", hr);
|
||||
|
||||
/* backbuffer ==> texture, full surface blits, no scaling */
|
||||
dst_rect.left = 0; dst_rect.right = 640;
|
||||
dst_rect.top = 0; dst_rect.bottom = 480;
|
||||
src_rect.left = 0; src_rect.right = 640;
|
||||
src_rect.top = 0; src_rect.bottom = 480;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, backbuffer, &src_rect, 0, NULL);
|
||||
ok(hr == DD_OK, "fullscreen Blt from backbuffer => texture failed with hr = %08x\n", hr);
|
||||
|
||||
/* backbuffer ==> texture, flip in y-direction through source rectangle, no scaling (allowed) */
|
||||
dst_rect.left = 0; dst_rect.right = 640;
|
||||
dst_rect.top = 480; dst_rect.top = 0;
|
||||
src_rect.left = 0; src_rect.right = 640;
|
||||
src_rect.top = 0; src_rect.bottom = 480;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, backbuffer, &src_rect, 0, NULL);
|
||||
ok(hr == DD_OK, "backbuffer => texture flip-y src_rect failed with hr = %08x\n", hr);
|
||||
|
||||
/* backbuffer ==> texture, flip in x-direction through source rectangle, no scaling (not allowed) */
|
||||
dst_rect.left = 640; dst_rect.right = 0;
|
||||
dst_rect.top = 0; dst_rect.top = 480;
|
||||
src_rect.left = 0; src_rect.right = 640;
|
||||
src_rect.top = 0; src_rect.bottom = 480;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, backbuffer, &src_rect, 0, NULL);
|
||||
ok(hr == DDERR_INVALIDRECT, "backbuffer => texture flip-x src_rect failed with hr = %08x\n", hr);
|
||||
|
||||
/* backbuffer ==> texture, flip in y-direction through destination rectangle (not allowed) */
|
||||
dst_rect.left = 0; dst_rect.right = 640;
|
||||
dst_rect.top = 0; dst_rect.top = 480;
|
||||
src_rect.left = 0; src_rect.right = 640;
|
||||
src_rect.top = 480; src_rect.bottom = 0;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, backbuffer, &src_rect, 0, NULL);
|
||||
ok(hr == DDERR_INVALIDRECT, "backbuffer => texture flip-y dst_rect failed with hr = %08x\n", hr);
|
||||
|
||||
/* backbuffer ==> texture, flip in x-direction through destination rectangle, no scaling (not allowed) */
|
||||
dst_rect.left = 0; dst_rect.right = 640;
|
||||
dst_rect.top = 0; dst_rect.top = 480;
|
||||
src_rect.left = 640; src_rect.right = 0;
|
||||
src_rect.top = 0; src_rect.bottom = 480;
|
||||
hr = IDirectDrawSurface_Blt(offscreen, &dst_rect, backbuffer, &src_rect, 0, NULL);
|
||||
ok(hr == DDERR_INVALIDRECT, "backbuffer => texture flip-x dst_rect failed with hr = %08x\n", hr);
|
||||
}
|
||||
|
||||
if(offscreen) IDirectDrawSurface7_Release(offscreen);
|
||||
if(backbuffer) IDirectDrawSurface7_Release(backbuffer);
|
||||
}
|
||||
|
||||
static void offscreen_test(IDirect3DDevice7 *device)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -2130,7 +2023,6 @@ START_TEST(visual)
|
|||
}
|
||||
|
||||
/* Now run the tests */
|
||||
blt_test(Direct3DDevice);
|
||||
depth_clamp_test(Direct3DDevice);
|
||||
clear_test(Direct3DDevice);
|
||||
fog_test(Direct3DDevice);
|
||||
|
|
Loading…
Reference in New Issue