DXGL r98 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r97‎ | r98 | r99 >
Date:19:56, 5 February 2012
Author:admin
Status:new
Tags:
Comment:
Fix release compilation.
Fix clipper deletion.
Modified paths:
  • /ddraw/common.h (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDraw.h (modified) (history)
  • /ddraw/glDirectDrawClipper.cpp (modified) (history)

Diff [purge]

Index: ddraw/common.h
@@ -75,6 +75,9 @@
7676 DEBUGBREAK\
7777 return error;\
7878 }
 79+#else
 80+#define ERR(error) return error;
 81+#endif
7982
8083 static inline int NextMultipleOf8(int number){return ((number+7) & (~7));}
8184 static inline int NextMultipleOf4(int number){return ((number+3) & (~3));}
@@ -85,8 +88,5 @@
8689 #define NextMultipleOfWord NextMultipleOf4
8790 #endif
8891
89 -#else
90 -#define ERR(error) return error;
91 -#endif
9292 #include "../cfgmgr/cfgmgr.h"
9393 #endif //_COMMON_H
Index: ddraw/glDirectDraw.cpp
@@ -578,7 +578,10 @@
579579 if(clippers)
580580 {
581581 for(int i = 0; i < clippercount; i++)
582 - clippers[i]->Release();
 582+ {
 583+ if(clippers[i]) clippers[i]->Release();
 584+ clippers[i] = NULL;
 585+ }
583586 free(clippers);
584587 }
585588 if(surfaces)
@@ -790,8 +793,8 @@
791794 ZeroMemory(&ddCaps,sizeof(DDCAPS_DX7));
792795 if(lpDDDriverCaps) ddCaps.dwSize = lpDDDriverCaps->dwSize;
793796 else if(lpDDHELCaps) ddCaps.dwSize = lpDDHELCaps->dwSize;
 797+ else return DDERR_INVALIDPARAMS;
794798 if(ddCaps.dwSize > sizeof(DDCAPS_DX7)) ddCaps.dwSize = sizeof(DDCAPS_DX7);
795 - else return DDERR_INVALIDPARAMS;
796799 ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTSTRETCH |
797800 DDCAPS_COLORKEY | DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM;
798801 ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED |
@@ -1406,6 +1409,12 @@
14071410 if(surface == primary) primary = NULL;
14081411 }
14091412
 1413+void glDirectDraw7::DeleteClipper(glDirectDrawClipper *clipper)
 1414+{
 1415+ for(int i = 0; i < clippercount; i++)
 1416+ if(clippers[i] == clipper) clippers[i] = NULL;
 1417+}
 1418+
14101419 // DDRAW1 wrapper
14111420 glDirectDraw1::glDirectDraw1(glDirectDraw7 *gl_DD7)
14121421 {
Index: ddraw/glDirectDraw.h
@@ -80,6 +80,7 @@
8181 DWORD primaryx,primaryy,primaryrefresh,primarybpp;
8282 bool GetFullscreen(){return fullscreen;};
8383 void DeleteSurface(glDirectDrawSurface7 *surface);
 84+ void DeleteClipper(glDirectDrawClipper *clipper);
8485 glDirectDrawSurface7 *primary;
8586 bool primarylost;
8687 glRenderer *renderer;
Index: ddraw/glDirectDrawClipper.cpp
@@ -16,6 +16,7 @@
1717 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818
1919 #include "common.h"
 20+#include "glDirectDraw.h"
2021 #include "glDirectDrawClipper.h"
2122
2223 glDirectDrawClipper::glDirectDrawClipper()
@@ -32,6 +33,7 @@
3334 }
3435 glDirectDrawClipper::~glDirectDrawClipper()
3536 {
 37+ if(glDD7) glDD7->DeleteClipper(this);
3638 }
3739 HRESULT WINAPI glDirectDrawClipper::QueryInterface(REFIID riid, LPVOID* obp)
3840 {