From bf2121a3120531bf0710447c66ea6269834c6252 Mon Sep 17 00:00:00 2001 From: Raphael Junqueira Date: Mon, 16 Jun 2003 20:20:25 +0000 Subject: [PATCH] Fix AddDirtyRect uncorrect behavior (crash in some cases). Based on a patch from Roderick Colenbrander. --- dlls/d3d8/surface.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 2f01777eae0..db6d5347e5c 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -598,9 +598,16 @@ HRESULT WINAPI IDirect3DSurface8Impl_CleanDirtyRect(LPDIRECT3DSURFACE8 iface) { extern HRESULT WINAPI IDirect3DSurface8Impl_AddDirtyRect(LPDIRECT3DSURFACE8 iface, CONST RECT* pDirtyRect) { ICOM_THIS(IDirect3DSurface8Impl,iface); This->Dirty = TRUE; - This->dirtyRect.left = min(This->dirtyRect.left, pDirtyRect->left); - This->dirtyRect.top = min(This->dirtyRect.top, pDirtyRect->top); - This->dirtyRect.right = max(This->dirtyRect.right, pDirtyRect->right); - This->dirtyRect.bottom = max(This->dirtyRect.bottom, pDirtyRect->bottom); + if (NULL != pDirtyRect) { + This->dirtyRect.left = min(This->dirtyRect.left, pDirtyRect->left); + This->dirtyRect.top = min(This->dirtyRect.top, pDirtyRect->top); + This->dirtyRect.right = max(This->dirtyRect.right, pDirtyRect->right); + This->dirtyRect.bottom = max(This->dirtyRect.bottom, pDirtyRect->bottom); + } else { + This->dirtyRect.left = 0; + This->dirtyRect.top = 0; + This->dirtyRect.right = This->myDesc.Width; + This->dirtyRect.bottom = This->myDesc.Height; + } return D3D_OK; }