-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2015-08-25 um 11:17 schrieb Sebastian Lackner:
if (match_flags != DDENUMSURFACES_MATCH)
return DDERR_INVALIDPARAMS;
Personally I prefer if the code writes WARN messages if it returns an error.
memcpy(&testdesc, DDSD, sizeof(testdesc));
Technically you should honor DDSD.dwSize. Most likely the correct behavior is to return an error if the size doesn't match sizeof(DDSURFACEDESC) in IDirectDraw and IDirectDraw2 or sizeof(DDSURFACEDESC2) in IDirectDraw4 and 7.
if (!(testdesc.dwFlags & DDSD_WIDTH))
{
testdesc.dwFlags |= DDSD_WIDTH;
testdesc.dwWidth = 512;
}
if (!(testdesc.dwFlags & DDSD_HEIGHT))
{
testdesc.dwFlags |= DDSD_HEIGHT;
testdesc.dwHeight = 512;
}
Does it inject any caps or pixelformat if they aren't set? Does it fall back to DDSCAPS_SYSTEMMEMORY if you don't request a location and whatever pixel format or size you request isn't supported?
hr = IDirectDraw7_CreateSurface(iface, &testdesc, &surface, NULL);
if (SUCCEEDED(hr)) {
...
surf = unsafe_impl_from_IDirectDrawSurface7(surface);
Callback(NULL, &surf->surface_desc, Context);
IDirectDrawSurface7_Release(surface); }
else
ERR("Failed to create surface, hr %#x.\n", hr);
I don't think that's an ERR. It may be a legitimate case where the surface requested by the application isn't supported. A question that should be answered by the tests is if EnumSurfaces just enumerates 0 descs with success, or if it returns a failure.