DXGL r541 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r540‎ | r541 | r542 >
Date:15:38, 20 September 2014
Author:admin
Status:new
Tags:
Comment:
Fail CreatePalette if cooperative level is not set, and return proper no-aggregation error.
Don't AddRef DDraw object for CreateSurface version 1 or 2.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDraw.h (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -885,6 +885,7 @@
886886 {
887887 TRACE_ENTER(5, 14, this, 9, dwFlags, 14, lpDDColorArray, 14, lplpDDPalette, 14, pUnkOuter);
888888 if (!this) TRACE_RET(HRESULT, 23, DDERR_INVALIDOBJECT);
 889+ if (pUnkOuter) TRACE_RET(HRESULT, 23, CLASS_E_NOAGGREGATION);
889890 HRESULT ret = CreatePalette2(dwFlags, lpDDColorArray, lplpDDPalette, pUnkOuter);
890891 if (ret == DD_OK)
891892 {
@@ -900,7 +901,8 @@
901902 TRACE_ENTER(5,14,this,9,dwFlags,14,lpDDColorArray,14,lplpDDPalette,14,pUnkOuter);
902903 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
903904 if(!lplpDDPalette) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
904 - if(pUnkOuter) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
 905+ if(pUnkOuter) TRACE_RET(HRESULT,23,CLASS_E_NOAGGREGATION);
 906+ if (!cooplevel) TRACE_RET(HRESULT, 23, DDERR_NOCOOPERATIVELEVELSET);
905907 HRESULT ret = glDirectDrawPalette_Create(dwFlags, lpDDColorArray, lplpDDPalette);
906908 TRACE_VAR("*lplpDDPalette",14,*lplpDDPalette);
907909 TRACE_EXIT(23,ret);
@@ -1369,6 +1371,7 @@
13701372 fpusetup = false;
13711373 threadsafe = false;
13721374 nowindowchanges = false;
 1375+ cooplevel = 0;
13731376 timer = timeGetTime();
13741377 ZeroMemory(&oldmode,sizeof(DEVMODE));
13751378 surfaces = (glDirectDrawSurface7 **)malloc(1024*sizeof(glDirectDrawSurface7 *));
@@ -1494,6 +1497,7 @@
14951498 internalrefresh = primaryrefresh = screenrefresh = devmode.dmDisplayFrequency;
14961499 primarybpp = bpp;
14971500 InitGL(x,y,bpp,fullscreen,internalrefresh,hWnd,this,devwnd);
 1501+ cooplevel = dwFlags;
14981502 TRACE_EXIT(23,DD_OK);
14991503 return DD_OK;
15001504 }
@@ -2109,8 +2113,6 @@
21102114 {
21112115 lpDDS7->QueryInterface(IID_IDirectDrawSurface,(LPVOID*) lplpDDSurface);
21122116 lpDDS7->Release();
2113 - this->AddRef();
2114 - ((glDirectDrawSurface7*)lpDDS7)->creator = this;
21152117 TRACE_VAR("*lplpDDSurface",14,lplpDDSurface);
21162118 TRACE_EXIT(23,DD_OK);
21172119 return DD_OK;
@@ -2313,8 +2315,6 @@
23142316 {
23152317 lpDDS7->QueryInterface(IID_IDirectDrawSurface,(LPVOID*) lplpDDSurface);
23162318 lpDDS7->Release();
2317 - this->AddRef();
2318 - ((glDirectDrawSurface7*)lpDDS7)->creator = this;
23192319 TRACE_EXIT(23, DD_OK);
23202320 return DD_OK;
23212321 }
Index: ddraw/glDirectDraw.h
@@ -137,6 +137,7 @@
138138 glDirect3D1 *glD3D1;
139139 DWORD timer;
140140 bool devwnd;
 141+ DWORD cooplevel;
141142 };
142143
143144 class glDirectDraw1 : public IDirectDraw