DXGL r121 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r120
|
r121
|
r122
>
Date:
21:23, 11 March 2012
Author:
admin
Status:
new
Tags:
Comment:
Add GetTexture and SetTexture
Modified paths:
/ddraw/glDirect3DDevice.cpp
(modified) (
history
)
/ddraw/glDirect3DDevice.h
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glDirect3DDevice.cpp
—
—
@@ -26,7 +26,7 @@
27
27
#include "glutil.h"
28
28
#include "matrix.h"
29
29
30
-const DWORD renderstate_default[153] = {0, // 0
30
+const DWORD renderstate_default[153] = {0, // 0
31
31
NULL, //texturehandle
32
32
D3DANTIALIAS_NONE, //antialias
33
33
D3DTADDRESS_WRAP, //textureaddress
—
—
@@ -141,7 +141,8 @@
142
142
1,
143
143
0,
144
144
0,
145
- D3DTTFF_DISABLE
145
+ D3DTTFF_DISABLE,
146
+ NULL
146
147
};
147
148
const TEXTURESTAGE texstagedefault1 =
148
149
{
—
—
@@ -164,7 +165,8 @@
165
166
1,
166
167
0,
167
168
0,
168
- D3DTTFF_DISABLE
169
+ D3DTTFF_DISABLE,
170
+ NULL
169
171
};
170
172
171
173
int setdrawmode(D3DPRIMITIVETYPE d3dptPrimitiveType)
—
—
@@ -225,6 +227,8 @@
226
228
for(int i = 0; i < lightsmax; i++)
227
229
if(lights[i]) delete lights[i];
228
230
delete lights;
231
+ for(int i = 0; i < 8; i++)
232
+ if(texstages[i].texture) texstages[i].texture->Release();
229
233
glD3D7->Release();
230
234
glDDS7->Release();
231
235
}
—
—
@@ -621,9 +625,13 @@
622
626
}
623
627
HRESULT WINAPI glDirect3DDevice7::GetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 *lplpTexture)
624
628
{
629
+ if(!lplpTexture) return DDERR_INVALIDPARAMS;
625
630
if(!this) return DDERR_INVALIDPARAMS;
626
- FIXME("glDirect3DDevice7::GetTexture: stub");
627
- ERR(DDERR_GENERIC);
631
+ if(dwStage > 7) return DDERR_INVALIDPARAMS;
632
+ if(!texstages[dwStage].texture) return DDERR_INVALIDOBJECT;
633
+ *lplpTexture = texstages[dwStage].texture;
634
+ texstages[dwStage].texture->AddRef();
635
+ return D3D_OK;
628
636
}
629
637
HRESULT WINAPI glDirect3DDevice7::GetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, LPDWORD lpdwValue)
630
638
{
—
—
@@ -852,8 +860,11 @@
853
861
HRESULT WINAPI glDirect3DDevice7::SetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 lpTexture)
854
862
{
855
863
if(!this) return DDERR_INVALIDPARAMS;
856
- FIXME("glDirect3DDevice7::SetTexture: stub");
857
- ERR(DDERR_GENERIC);
864
+ if(dwStage > 7) return DDERR_INVALIDPARAMS;
865
+ if(texstages[dwStage].texture) texstages[dwStage].texture->Release();
866
+ texstages[dwStage].texture = (glDirectDrawSurface7*)lpTexture;
867
+ if(lpTexture) lpTexture->AddRef();
868
+ return D3D_OK;
858
869
}
859
870
HRESULT WINAPI glDirect3DDevice7::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue)
860
871
{
Index: ddraw/glDirect3DDevice.h
—
—
@@ -44,6 +44,7 @@
45
45
D3DVALUE bumpenvlscale;
46
46
D3DVALUE bumpenvloffset;
47
47
D3DTEXTURETRANSFORMFLAGS textransform;
48
+ glDirectDrawSurface7 *texture;
48
49
};
49
50
50
51
class glDirect3DLight;
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version