Be less strict on parameter checking in the SetSurfaceDesc function.
This commit is contained in:
parent
bacc1b3b58
commit
262cbcdb09
|
@ -1014,13 +1014,28 @@ DIB_DirectDrawSurface_SetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface,
|
||||||
ICOM_THIS(IDirectDrawSurfaceImpl,iface);
|
ICOM_THIS(IDirectDrawSurfaceImpl,iface);
|
||||||
DIB_PRIV_VAR(priv, This);
|
DIB_PRIV_VAR(priv, This);
|
||||||
HRESULT hr = DD_OK;
|
HRESULT hr = DD_OK;
|
||||||
|
DWORD flags = pDDSD->dwFlags;
|
||||||
|
|
||||||
TRACE("(%p)->(%p,%08lx)\n",iface,pDDSD,dwFlags);
|
if (TRACE_ON(ddraw)) {
|
||||||
if (pDDSD->dwFlags == DDSD_LPSURFACE) {
|
TRACE("(%p)->(%p,%08lx)\n",iface,pDDSD,dwFlags);
|
||||||
|
DDRAW_dump_surface_desc(pDDSD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pDDSD->dwFlags & DDSD_PIXELFORMAT) {
|
||||||
|
flags &= ~DDSD_PIXELFORMAT;
|
||||||
|
if (flags & DDSD_LPSURFACE) {
|
||||||
|
This->surface_desc.u4.ddpfPixelFormat = pDDSD->u4.ddpfPixelFormat;
|
||||||
|
} else {
|
||||||
|
FIXME("Change of pixel format without surface re-allocation is not supported !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pDDSD->dwFlags & DDSD_LPSURFACE) {
|
||||||
HBITMAP oldbmp = priv->dib.DIBsection;
|
HBITMAP oldbmp = priv->dib.DIBsection;
|
||||||
LPVOID oldsurf = This->surface_desc.lpSurface;
|
LPVOID oldsurf = This->surface_desc.lpSurface;
|
||||||
BOOL oldc = priv->dib.client_memory;
|
BOOL oldc = priv->dib.client_memory;
|
||||||
|
|
||||||
|
flags &= ~DDSD_LPSURFACE;
|
||||||
|
|
||||||
TRACE("new lpSurface=%p\n",pDDSD->lpSurface);
|
TRACE("new lpSurface=%p\n",pDDSD->lpSurface);
|
||||||
This->surface_desc.lpSurface = pDDSD->lpSurface;
|
This->surface_desc.lpSurface = pDDSD->lpSurface;
|
||||||
priv->dib.client_memory = TRUE;
|
priv->dib.client_memory = TRUE;
|
||||||
|
@ -1038,13 +1053,9 @@ DIB_DirectDrawSurface_SetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface,
|
||||||
|
|
||||||
if (!oldc)
|
if (!oldc)
|
||||||
VirtualFree(oldsurf, 0, MEM_RELEASE);
|
VirtualFree(oldsurf, 0, MEM_RELEASE);
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
else {
|
if (flags) {
|
||||||
FIXME("flags=%08lx\n",pDDSD->dwFlags);
|
WARN("Unhandled flags : %08lx\n", flags);
|
||||||
abort();
|
|
||||||
hr = E_FAIL;
|
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue