[3/3] ddraw: Implement DDENUMSURFACES_CANBECREATED flag in ddraw7_EnumSurfaces.

Stefan Dösinger stefandoesinger at gmail.com
Tue Aug 25 15:34:45 CDT 2015


-----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.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJV3NFlAAoJEN0/YqbEcdMwRm0P/jajJLkLdEd4gjVCm/siaccO
UmNvomXKOhkrh9kLI7LWZQ2B4fvuc5pma0K6klngRhaoa3+ZIAC59q9eTGzQieWB
ibE9LXRU9FHFNThjprkGyHZtYu0MHRTTrYfgsRtOVhpfBTkxPYtKPsxJqEDqi9ug
xyRNzuRxz+bsG+4DFocwKXHQtbq/dXndHC5i2VyWh3uUX7HI1QJ1klIbaNf8kBGn
w+Hm09qzWU0uudNKNRUTqvulUgd/OPn133h1/IkB27OhdDe0jexVl5hFc+7fyQFG
dZ6kdQEimJ1jz9eRIItfOWLYvOKC0J3x7H8kQnQeoeDNJVnoK0rYS5mAz+p4gWLY
3eeuhKeq2iQ1P6851x9KnywZ/wEwSabg6ZqgCrQUCVdIVQNb+s6b5e5BEip/C3BG
oSXgO/7ONj682c3S0GoiYFx6eMUPPGS7xbMqhHDJqfQneUEGUXU8VGgT+snTxsS/
JJ0NzQOlmwZm0wx7zCPwjs9173Vz25tCMuAm18CvkRLoXygZeUzU7PbfXE2qqO6j
iNsfkUCP7rA+XhCV/vMFdzThI8j0YEDFPliZumQCJ5qN/Yz/6dhls+3J0IHMZexa
iGjHFsTlI/yXc01+865tZZQaFEFZEJ0rfE7RChMFsY9LTGe2bzc6P49gdjuhm1em
zLhWBw58Jqx2LoY/wAFR
=1rMk
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list