[dx52] fix AddDirtyRect

Raphaël Junqueira fenix at club-internet.fr
Fri Jun 6 12:33:17 CDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Hi all,

Hi,

> This patch fixes a problem that appeared in Mafia. 

how mafia works ? ;)))

> Before this function 
> crashed when pDirtyRect was null. According to MSDN D3DERR_INVALIDCALL
> should be returned in case of problems.

Well,
this is not really the good way to fix the problem (as the surface isn't 
dirtified)

IDirect3DSurface8Impl_AddDirtyRect is an internal function (as seen in 
d3d8_provate.h declaration) so i cannot see where you have found the msdn 
docs ;)

I think you wanted to fix a crash who happened in some 
IDirect3D*TextureImpl_AddDirty* call no ?

if yes, can you try this patch instead ?

> Regards,
> Roderick Colenbrander

Thanks,
Raphael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+4NBdp7NA3AmQTU4RAkkxAJ9oHG+cSN5Px+mga6BQrrb/wytc9QCfRpc2
QMvmNo9HL43iicyKWEfp1bY=
=H46H
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: surface.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/surface.c,v
retrieving revision 1.15
diff -u -r1.15 surface.c
--- surface.c	4 Jun 2003 23:05:46 -0000	1.15
+++ surface.c	6 Jun 2003 17:29:05 -0000
@@ -604,9 +604,16 @@
 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;
 }


More information about the wine-devel mailing list