Commit c53487b5 authored by David Hedberg's avatar David Hedberg Committed by Alexandre Julliard

ddraw: Fix and test case for situation where DDSD_MIPMAPCOUNT is set and dwMipMapCount is 0.

parent 2456473d
......@@ -2417,7 +2417,12 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
{
if(desc2.dwFlags & DDSD_MIPMAPCOUNT)
{
/* Mipmap count is given, nothing to do */
/* Mipmap count is given, should not be 0 */
if( desc2.u2.dwMipMapCount == 0 )
{
LeaveCriticalSection(&ddraw_cs);
return DDERR_INVALIDPARAMS;
}
}
else
{
......
......@@ -183,6 +183,25 @@ static void MipMapCreationTest(void)
/* Destroy the surface. */
IDirectDrawSurface_Release(lpDDSMipMapTest);
/* Fifth mipmap creation test: try to create a surface with
DDSCAPS_COMPLEX, DDSCAPS_MIPMAP, DDSD_MIPMAPCOUNT,
where dwMipMapCount = 0. This should fail. */
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_MIPMAPCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP;
U2(ddsd).dwMipMapCount = 0;
ddsd.dwWidth = 128;
ddsd.dwHeight = 32;
rc = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSMipMapTest, NULL);
ok(rc==DDERR_INVALIDPARAMS,"CreateSurface returned: %x\n",rc);
/* Destroy the surface. */
if( rc == DD_OK )
IDirectDrawSurface_Release(lpDDSMipMapTest);
}
static void SrcColorKey32BlitTest(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment