DXGL r352 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r351‎ | r352 | r353 >
Date:23:32, 17 March 2013
Author:admin
Status:new
Tags:
Comment:
Trace glDurect3DTexture.cpp and fix a couple invalid object return values.
Modified paths:
  • /ddraw/glDirect3DTexture.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DTexture.cpp
@@ -25,134 +25,170 @@
2626
2727 glDirect3DTexture2::glDirect3DTexture2(glDirectDrawSurface7 *glDDS7)
2828 {
 29+ TRACE_ENTER(2,14,this,14,glDDS7);
2930 this->glDDS7 = glDDS7;
3031 refcount = 1;
 32+ TRACE_EXIT(-1,0);
3133 }
3234
3335 glDirect3DTexture2::~glDirect3DTexture2()
3436 {
 37+ TRACE_ENTER(1,14,this);
3538 glDDS7->d3dt2 = NULL;
3639 glDDS7->Release();
 40+ TRACE_EXIT(-1,0);
3741 }
3842
3943 HRESULT WINAPI glDirect3DTexture2::QueryInterface(REFIID riid, void** ppvObj)
4044 {
41 - if(!this) return DDERR_INVALIDPARAMS;
 45+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 46+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
4247 if(riid == IID_IUnknown)
4348 {
4449 this->AddRef();
4550 *ppvObj = this;
 51+ TRACE_VAR("*ppvObj",14,*ppvObj);
 52+ TRACE_EXIT(23,DD_OK);
4653 return DD_OK;
4754 }
48 - return glDDS7->QueryInterface(riid,ppvObj);
 55+ TRACE_RET(23,glDDS7->QueryInterface(riid,ppvObj));
4956 }
5057
5158 ULONG WINAPI glDirect3DTexture2::AddRef()
5259 {
53 - if(!this) return 0;
 60+ TRACE_ENTER(1,14,this);
 61+ if(!this) TRACE_RET(8,0);
5462 refcount++;
 63+ TRACE_EXIT(8,refcount);
5564 return refcount;
5665 }
5766
5867 ULONG WINAPI glDirect3DTexture2::Release()
5968 {
60 - if(!this) return 0;
 69+ TRACE_ENTER(1,14,this);
 70+ if(!this) TRACE_RET(8,0);
6171 ULONG ret;
6272 refcount--;
6373 ret = refcount;
6474 if(refcount == 0) delete this;
 75+ TRACE_EXIT(8,ret);
6576 return ret;
6677 }
6778
6879 HRESULT WINAPI glDirect3DTexture2::GetHandle(LPDIRECT3DDEVICE2 lpDirect3DDevice2, LPD3DTEXTUREHANDLE lpHandle)
6980 {
70 - if(!this) return DDERR_INVALIDOBJECT;
71 - if(!lpDirect3DDevice2) return DDERR_INVALIDPARAMS;
 81+ TRACE_ENTER(3,14,this,14,lpDirect3DDevice2,14,lpHandle);
 82+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 83+ if(!lpDirect3DDevice2) TRACE_RET(23,DDERR_INVALIDPARAMS);
7284 glDirect3DDevice7 *glD3DDev7;
7385 lpDirect3DDevice2->QueryInterface(IID_IDirect3DDevice7,(void**)&glD3DDev7);
7486 HRESULT ret = glDDS7->GetHandle(glD3DDev7,lpHandle);
7587 glD3DDev7->Release();
 88+ TRACE_EXIT(23,ret);
7689 return ret;
7790 }
7891 HRESULT WINAPI glDirect3DTexture2::Load(LPDIRECT3DTEXTURE2 lpD3DTexture2)
7992 {
80 - if(!this) return DDERR_INVALIDOBJECT;
81 - if(!lpD3DTexture2) return DDERR_INVALIDPARAMS;
82 - return glDDS7->Load(((glDirect3DTexture2*)lpD3DTexture2)->GetDDS7());
 93+ TRACE_ENTER(2,14,this,14,lpD3DTexture2);
 94+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 95+ if(!lpD3DTexture2) TRACE_RET(23,DDERR_INVALIDPARAMS);
 96+ TRACE_RET(23,glDDS7->Load(((glDirect3DTexture2*)lpD3DTexture2)->GetDDS7()));
8397 }
8498 HRESULT WINAPI glDirect3DTexture2::PaletteChanged(DWORD dwStart, DWORD dwCount)
8599 {
86 - if(!this) return DDERR_INVALIDOBJECT;
 100+ TRACE_ENTER(3,14,this,8,dwStart,8,dwCount);
 101+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
87102 FIXME("glDirect3DTexture2::PaletteChanged: stub");
 103+ TRACE_EXIT(23,DDERR_GENERIC);
88104 return DDERR_GENERIC;
89105 }
90106
91107 glDirect3DTexture1::glDirect3DTexture1(glDirectDrawSurface7 *glDDS7)
92108 {
 109+ TRACE_ENTER(2,14,this,14,glDDS7);
93110 this->glDDS7 = glDDS7;
94111 refcount = 1;
 112+ TRACE_EXIT(-1,0);
95113 }
96114 glDirect3DTexture1::~glDirect3DTexture1()
97115 {
 116+ TRACE_ENTER(1,14,this);
98117 glDDS7->d3dt1 = NULL;
99118 glDDS7->Release();
 119+ TRACE_EXIT(-1,0);
100120 }
101121 HRESULT WINAPI glDirect3DTexture1::QueryInterface(REFIID riid, void** ppvObj)
102122 {
103 - if(!this) return DDERR_INVALIDPARAMS;
 123+ TRACE_ENTER(3,14,this,24,&riid,14,ppvObj);
 124+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
104125 if(riid == IID_IUnknown)
105126 {
106127 this->AddRef();
107128 *ppvObj = this;
 129+ TRACE_VAR("*ppvObj",14,*ppvObj);
 130+ TRACE_EXIT(23,DD_OK);
108131 return DD_OK;
109132 }
110 - return glDDS7->QueryInterface(riid,ppvObj);
 133+ TRACE_RET(23,glDDS7->QueryInterface(riid,ppvObj));
111134 }
112135 ULONG WINAPI glDirect3DTexture1::AddRef()
113136 {
114 - if(!this) return 0;
 137+ TRACE_ENTER(1,14,this);
 138+ if(!this) TRACE_RET(8,0);
115139 refcount++;
 140+ TRACE_EXIT(8,refcount);
116141 return refcount;
117142 }
118143 ULONG WINAPI glDirect3DTexture1::Release()
119144 {
120 - if(!this) return 0;
 145+ TRACE_ENTER(1,14,this);
 146+ if(!this) TRACE_RET(8,0);
121147 ULONG ret;
122148 refcount--;
123149 ret = refcount;
124150 if(refcount == 0) delete this;
 151+ TRACE_EXIT(8,ret);
125152 return ret;
126153 }
127154
128155 HRESULT WINAPI glDirect3DTexture1::GetHandle(LPDIRECT3DDEVICE lpDirect3DDevice, LPD3DTEXTUREHANDLE lpHandle)
129156 {
130 - if(!this) return DDERR_INVALIDOBJECT;
131 - if(!lpDirect3DDevice) return DDERR_INVALIDPARAMS;
 157+ TRACE_ENTER(3,14,this,14,lpDirect3DDevice,14,lpHandle);
 158+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 159+ if(!lpDirect3DDevice) TRACE_RET(23,DDERR_INVALIDPARAMS);
132160 glDirect3DDevice7 *glD3DDev7;
133161 lpDirect3DDevice->QueryInterface(IID_IDirect3DDevice7,(void**)&glD3DDev7);
134162 HRESULT ret = glDDS7->GetHandle(glD3DDev7,lpHandle);
135163 glD3DDev7->Release();
 164+ TRACE_EXIT(23,ret);
136165 return ret;
137166 }
138167 HRESULT WINAPI glDirect3DTexture1::Initialize(LPDIRECT3DDEVICE lpD3DDevice, LPDIRECTDRAWSURFACE lpDDSurface)
139168 {
140 - if(!this) return DDERR_INVALIDOBJECT;
 169+ TRACE_ENTER(3,14,this,14,lpD3DDevice,14,lpDDSurface);
 170+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 171+ TRACE_EXIT(23,DDERR_ALREADYINITIALIZED);
141172 return DDERR_ALREADYINITIALIZED;
142173 }
143174 HRESULT WINAPI glDirect3DTexture1::Load(LPDIRECT3DTEXTURE lpD3DTexture)
144175 {
145 - if(!this) return DDERR_INVALIDOBJECT;
146 - if(!lpD3DTexture) return DDERR_INVALIDPARAMS;
147 - return glDDS7->Load(((glDirect3DTexture1*)lpD3DTexture)->GetDDS7());
 176+ TRACE_ENTER(2,14,this,14,lpD3DTexture);
 177+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 178+ if(!lpD3DTexture) TRACE_RET(23,DDERR_INVALIDPARAMS);
 179+ TRACE_RET(23,glDDS7->Load(((glDirect3DTexture1*)lpD3DTexture)->GetDDS7()));
148180 }
149181 HRESULT WINAPI glDirect3DTexture1::PaletteChanged(DWORD dwStart, DWORD dwCount)
150182 {
151 - if(!this) return DDERR_INVALIDOBJECT;
 183+ TRACE_ENTER(3,14,this,8,dwStart,8,dwCount);
 184+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
152185 FIXME("glDirect3DTexture1::PaletteChanged: stub");
 186+ TRACE_EXIT(23,DDERR_GENERIC);
153187 return DDERR_GENERIC;
154188 }
155189 HRESULT WINAPI glDirect3DTexture1::Unload()
156190 {
157 - if(!this) return DDERR_INVALIDOBJECT;
 191+ TRACE_ENTER(1,14,this);
 192+ if(!this) TRACE_RET(23,DDERR_INVALIDOBJECT);
 193+ TRACE_EXIT(23,DDERR_UNSUPPORTED);
158194 return DDERR_UNSUPPORTED;
159195 }