Index: ddraw/ddraw.cpp |
— | — | @@ -227,15 +227,7 @@ |
228 | 228 | HRESULT WINAPI DirectDrawCreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
|
229 | 229 | {
|
230 | 230 | TRACE_ENTER(3,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
|
231 | | - *lplpDDClipper = new glDirectDrawClipper(dwFlags,NULL);
|
232 | | - if(!lplpDDClipper)
|
233 | | - {
|
234 | | - TRACE_EXIT(23,DDERR_OUTOFMEMORY);
|
235 | | - return DDERR_OUTOFMEMORY;
|
236 | | - }
|
237 | | - TRACE_VAR("*lplpDDClipper",14,*lplpDDClipper);
|
238 | | - TRACE_EXIT(23,DD_OK);
|
239 | | - return DD_OK;
|
| 231 | + TRACE_RET(HRESULT, 23, glDirectDrawClipper_Create(dwFlags, NULL, lplpDDClipper));
|
240 | 232 | }
|
241 | 233 |
|
242 | 234 | /**
|
Index: ddraw/glClassFactory.cpp |
— | — | @@ -103,10 +103,7 @@ |
104 | 104 | }
|
105 | 105 | if(riid == IID_IDirectDrawClipper)
|
106 | 106 | {
|
107 | | - *ppvObject = new glDirectDrawClipper();
|
108 | | - TRACE_VAR("*ppvObject",14,*ppvObject);
|
109 | | - TRACE_EXIT(23,S_OK);
|
110 | | - return S_OK;
|
| 107 | + TRACE_RET(HRESULT, 23, glDirectDrawClipper_CreateNoInit((LPDIRECTDRAWCLIPPER*)ppvObject));
|
111 | 108 | }
|
112 | 109 | FIXME("glClassFactory::CreateInterface: stub");
|
113 | 110 | TRACE_EXIT(23,E_NOINTERFACE);
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -615,7 +615,7 @@ |
616 | 616 | {
|
617 | 617 | for(int i = 0; i < clippercount; i++)
|
618 | 618 | {
|
619 | | - if(clippers[i]) clippers[i]->Release();
|
| 619 | + if(clippers[i]) glDirectDrawClipper_Release(clippers[i]);
|
620 | 620 | clippers[i] = NULL;
|
621 | 621 | }
|
622 | 622 | free(clippers);
|
— | — | @@ -810,11 +810,7 @@ |
811 | 811 | ZeroMemory(&clippers[clippercountmax],1024*sizeof(glDirectDrawClipper *));
|
812 | 812 | clippercountmax += 1024;
|
813 | 813 | }
|
814 | | - clippers[clippercount-1] = new glDirectDrawClipper(dwFlags,this);
|
815 | | - *lplpDDClipper = clippers[clippercount-1];
|
816 | | - TRACE_VAR("*lplpDDClipper",14,*lplpDDClipper);
|
817 | | - TRACE_EXIT(23,DD_OK);
|
818 | | - return DD_OK;
|
| 814 | + TRACE_RET(HRESULT, 23, glDirectDrawClipper_Create(dwFlags, this, lplpDDClipper));
|
819 | 815 | }
|
820 | 816 | HRESULT WINAPI glDirectDraw7::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
|
821 | 817 | {
|
Index: ddraw/glDirectDraw.h |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | #define DXGLBLT_NOPALSHADER 0x80000000
|
24 | 24 |
|
25 | 25 | class glDirectDrawSurface7;
|
26 | | -class glDirectDrawClipper;
|
| 26 | +struct glDirectDrawClipper;
|
27 | 27 | class glDirect3D7;
|
28 | 28 | class glRenderer;
|
29 | 29 |
|
Index: ddraw/glDirectDrawClipper.cpp |
— | — | @@ -21,40 +21,61 @@ |
22 | 22 | #include "glDirectDraw.h"
|
23 | 23 | #include "glDirectDrawClipper.h"
|
24 | 24 |
|
25 | | -glDirectDrawClipper::glDirectDrawClipper()
|
| 25 | +glDirectDrawClipperVtbl glDirectDrawClipper_iface =
|
26 | 26 | {
|
27 | | - TRACE_ENTER(1,14,this);
|
28 | | - initialized = false;
|
29 | | - refcount = 1;
|
30 | | - TRACE_EXIT(-1,0);
|
31 | | -}
|
| 27 | + glDirectDrawClipper_QueryInterface,
|
| 28 | + glDirectDrawClipper_AddRef,
|
| 29 | + glDirectDrawClipper_Release,
|
| 30 | + glDirectDrawClipper_GetClipList,
|
| 31 | + glDirectDrawClipper_GetHWnd,
|
| 32 | + glDirectDrawClipper_Initialize,
|
| 33 | + glDirectDrawClipper_IsClipListChanged,
|
| 34 | + glDirectDrawClipper_SetClipList,
|
| 35 | + glDirectDrawClipper_SetHWnd
|
| 36 | +};
|
32 | 37 |
|
33 | | -glDirectDrawClipper::glDirectDrawClipper(DWORD dwFlags, glDirectDraw7 *parent)
|
| 38 | +HRESULT glDirectDrawClipper_CreateNoInit(LPDIRECTDRAWCLIPPER *lplpDDClipper)
|
34 | 39 | {
|
35 | | - TRACE_ENTER(3,14,this,9,dwFlags,14,parent);
|
36 | | - initialized = false;
|
37 | | - refcount = 1;
|
38 | | - Initialize((LPDIRECTDRAW)parent,dwFlags);
|
39 | | - TRACE_EXIT(-1,0);
|
| 40 | + glDirectDrawClipper *newclipper;
|
| 41 | + TRACE_ENTER(1, 14, lplpDDClipper);
|
| 42 | + if (!lplpDDClipper) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 43 | + newclipper = (glDirectDrawClipper*)malloc(sizeof(glDirectDrawClipper));
|
| 44 | + if (!newclipper) TRACE_RET(HRESULT, 23, DDERR_OUTOFMEMORY);
|
| 45 | + ZeroMemory(newclipper, sizeof(glDirectDrawClipper));
|
| 46 | + newclipper->refcount = 1;
|
| 47 | + newclipper->initialized = false;
|
| 48 | + newclipper->lpVtbl = &glDirectDrawClipper_iface;
|
| 49 | + if (lplpDDClipper) *lplpDDClipper = (LPDIRECTDRAWCLIPPER)newclipper;
|
| 50 | + TRACE_EXIT(23, DD_OK);
|
| 51 | + return DD_OK;
|
40 | 52 | }
|
41 | | -glDirectDrawClipper::~glDirectDrawClipper()
|
| 53 | +
|
| 54 | +HRESULT glDirectDrawClipper_Create(DWORD dwFlags, glDirectDraw7 *parent, LPDIRECTDRAWCLIPPER *lplpDDClipper)
|
42 | 55 | {
|
43 | | - TRACE_ENTER(1,14,this);
|
44 | | - if (cliplist) free(cliplist);
|
45 | | - if (vertices) free(vertices);
|
46 | | - if (indices) free(indices);
|
47 | | - if(glDD7) glDD7->DeleteClipper(this);
|
48 | | - TRACE_EXIT(-1,0);
|
| 56 | + glDirectDrawClipper *newclipper;
|
| 57 | + TRACE_ENTER(3, 9, dwFlags, 14, parent, 14, lplpDDClipper);
|
| 58 | + if (!lplpDDClipper) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 59 | + newclipper = (glDirectDrawClipper*)malloc(sizeof(glDirectDrawClipper));
|
| 60 | + if (!newclipper) TRACE_RET(HRESULT, 23, DDERR_OUTOFMEMORY);
|
| 61 | + ZeroMemory(newclipper, sizeof(glDirectDrawClipper));
|
| 62 | + newclipper->refcount = 1;
|
| 63 | + newclipper->initialized = false;
|
| 64 | + newclipper->lpVtbl = &glDirectDrawClipper_iface;
|
| 65 | + glDirectDrawClipper_Initialize(newclipper, (LPDIRECTDRAW)parent, dwFlags);
|
| 66 | + if (lplpDDClipper) *lplpDDClipper = (LPDIRECTDRAWCLIPPER)newclipper;
|
| 67 | + TRACE_EXIT(23, DD_OK);
|
| 68 | + return DD_OK;
|
49 | 69 | }
|
50 | | -HRESULT WINAPI glDirectDrawClipper::QueryInterface(REFIID riid, LPVOID* obp)
|
| 70 | +
|
| 71 | +HRESULT WINAPI glDirectDrawClipper_QueryInterface(glDirectDrawClipper *This, REFIID riid, LPVOID* obp)
|
51 | 72 | {
|
52 | | - TRACE_ENTER(3,14,this,24,&riid,14,obp);
|
53 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 73 | + TRACE_ENTER(3,14,This,24,&riid,14,obp);
|
| 74 | + if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
54 | 75 | if(!obp) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
55 | 76 | if(riid == IID_IUnknown)
|
56 | 77 | {
|
57 | | - this->AddRef();
|
58 | | - *obp = this;
|
| 78 | + glDirectDrawClipper_AddRef(This);
|
| 79 | + *obp = This;
|
59 | 80 | TRACE_VAR("*obp",14,*obp);
|
60 | 81 | TRACE_EXIT(23,DD_OK);
|
61 | 82 | return DD_OK;
|
— | — | @@ -61,9 +82,9 @@ |
62 | 83 | }
|
63 | 84 | if(riid == IID_IDirectDrawClipper)
|
64 | 85 | {
|
65 | | - *obp = this;
|
66 | | - this->AddRef();
|
67 | | - TRACE_VAR("*obp",14,*obp);
|
| 86 | + *obp = This;
|
| 87 | + glDirectDrawClipper_AddRef(This);
|
| 88 | + TRACE_VAR("*obp", 14, *obp);
|
68 | 89 | TRACE_EXIT(23,DD_OK);
|
69 | 90 | return DD_OK;
|
70 | 91 | }
|
— | — | @@ -70,75 +91,83 @@ |
71 | 92 | TRACE_EXIT(23,E_NOINTERFACE);
|
72 | 93 | return E_NOINTERFACE;
|
73 | 94 | }
|
74 | | -ULONG WINAPI glDirectDrawClipper::AddRef()
|
| 95 | +ULONG WINAPI glDirectDrawClipper_AddRef(glDirectDrawClipper *This)
|
75 | 96 | {
|
76 | | - TRACE_ENTER(1,14,this);
|
77 | | - if(!this) TRACE_RET(ULONG,8,0);
|
78 | | - refcount++;
|
79 | | - TRACE_EXIT(8,refcount);
|
80 | | - return refcount;
|
| 97 | + TRACE_ENTER(1,14,This);
|
| 98 | + if(!This) TRACE_RET(ULONG,8,0);
|
| 99 | + This->refcount++;
|
| 100 | + TRACE_EXIT(8,This->refcount);
|
| 101 | + return This->refcount;
|
81 | 102 | }
|
82 | | -ULONG WINAPI glDirectDrawClipper::Release()
|
| 103 | +ULONG WINAPI glDirectDrawClipper_Release(glDirectDrawClipper *This)
|
83 | 104 | {
|
84 | | - TRACE_ENTER(1,14,this);
|
85 | | - if(!this) TRACE_RET(ULONG,8,0);
|
| 105 | + TRACE_ENTER(1,14,This);
|
| 106 | + if(!This) TRACE_RET(ULONG,8,0);
|
86 | 107 | ULONG ret;
|
87 | | - refcount--;
|
88 | | - ret = refcount;
|
89 | | - if(refcount == 0) delete this;
|
| 108 | + This->refcount--;
|
| 109 | + ret = This->refcount;
|
| 110 | + if (This->refcount == 0)
|
| 111 | + {
|
| 112 | + if (This->cliplist) free(This->cliplist);
|
| 113 | + if (This->vertices) free(This->vertices);
|
| 114 | + if (This->indices) free(This->indices);
|
| 115 | + if (This->glDD7) This->glDD7->DeleteClipper(This);
|
| 116 | + free(This);
|
| 117 | + };
|
90 | 118 | TRACE_EXIT(8,ret);
|
91 | 119 | return ret;
|
92 | 120 | }
|
93 | | -HRESULT WINAPI glDirectDrawClipper::GetClipList(LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize)
|
| 121 | +HRESULT WINAPI glDirectDrawClipper_GetClipList(glDirectDrawClipper *This, LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize)
|
94 | 122 | {
|
95 | | - TRACE_ENTER(4,14,this,26,lpRect,14,lpClipList,14,lpdwSize);
|
96 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 123 | + TRACE_ENTER(4,14,This,26,lpRect,14,lpClipList,14,lpdwSize);
|
| 124 | + if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
97 | 125 | FIXME("IDirectDrawClipper::GetClipList: stub");
|
98 | 126 | TRACE_EXIT(23,DDERR_GENERIC);
|
99 | 127 | ERR(DDERR_GENERIC);
|
100 | 128 | }
|
101 | | -HRESULT WINAPI glDirectDrawClipper::GetHWnd(HWND FAR *lphWnd)
|
| 129 | +HRESULT WINAPI glDirectDrawClipper_GetHWnd(glDirectDrawClipper *This, HWND FAR *lphWnd)
|
102 | 130 | {
|
103 | | - TRACE_ENTER(2,14,this,14,lphWnd);
|
104 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
105 | | - if(!hWnd) TRACE_RET(HRESULT,23,DDERR_NOHWND);
|
106 | | - *lphWnd = hWnd;
|
| 131 | + TRACE_ENTER(2,14,This,14,lphWnd);
|
| 132 | + if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 133 | + if(!This->hWnd) TRACE_RET(HRESULT,23,DDERR_NOHWND);
|
| 134 | + *lphWnd = This->hWnd;
|
107 | 135 | TRACE_VAR("*lphWnd",13,*lphWnd);
|
108 | 136 | TRACE_EXIT(23,DD_OK);
|
109 | 137 | return DD_OK;
|
110 | 138 | }
|
111 | | -HRESULT WINAPI glDirectDrawClipper::Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags)
|
| 139 | +HRESULT WINAPI glDirectDrawClipper_Initialize(glDirectDrawClipper *This, LPDIRECTDRAW lpDD, DWORD dwFlags)
|
112 | 140 | {
|
113 | | - TRACE_ENTER(3,14,this,14,lpDD,9,dwFlags);
|
114 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
115 | | - if(initialized) TRACE_RET(HRESULT,23,DDERR_ALREADYINITIALIZED);
|
116 | | - glDD7 = (glDirectDraw7*)lpDD;
|
117 | | - if(glDD7) hasparent = true;
|
118 | | - else hasparent = false;
|
119 | | - hWnd = NULL;
|
120 | | - cliplist = NULL;
|
121 | | - vertices = NULL;
|
122 | | - indices = NULL;
|
123 | | - hascliplist = false;
|
124 | | - maxsize = clipsize = 0;
|
125 | | - refcount = 1;
|
126 | | - initialized = true;
|
| 141 | + TRACE_ENTER(3,14,This,14,lpDD,9,dwFlags);
|
| 142 | + if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 143 | + if(This->initialized) TRACE_RET(HRESULT,23,DDERR_ALREADYINITIALIZED);
|
| 144 | + This->glDD7 = (glDirectDraw7*)lpDD;
|
| 145 | + if(This->glDD7) This->hasparent = true;
|
| 146 | + else This->hasparent = false;
|
| 147 | + This->hWnd = NULL;
|
| 148 | + This->cliplist = NULL;
|
| 149 | + This->vertices = NULL;
|
| 150 | + This->indices = NULL;
|
| 151 | + This->hascliplist = false;
|
| 152 | + This->maxsize = This->clipsize = 0;
|
| 153 | + This->refcount = 1;
|
| 154 | + This->initialized = true;
|
| 155 | + This->dirty = true;
|
127 | 156 | TRACE_EXIT(23,DD_OK);
|
128 | 157 | return DD_OK;
|
129 | 158 | }
|
130 | | -HRESULT WINAPI glDirectDrawClipper::IsClipListChanged(BOOL FAR *lpbChanged)
|
| 159 | +HRESULT WINAPI glDirectDrawClipper_IsClipListChanged(glDirectDrawClipper *This, BOOL FAR *lpbChanged)
|
131 | 160 | {
|
132 | | - TRACE_ENTER(2,14,this,14,lpbChanged);
|
133 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 161 | + TRACE_ENTER(2,14,This,14,lpbChanged);
|
| 162 | + if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
134 | 163 | FIXME("IDirectDrawClipper::IsClipListChanged: stub");
|
135 | 164 | TRACE_EXIT(23,DDERR_GENERIC);
|
136 | 165 | ERR(DDERR_GENERIC);
|
137 | 166 | }
|
138 | | -HRESULT WINAPI glDirectDrawClipper::SetClipList(LPRGNDATA lpClipList, DWORD dwFlags)
|
| 167 | +HRESULT WINAPI glDirectDrawClipper_SetClipList(glDirectDrawClipper *This, LPRGNDATA lpClipList, DWORD dwFlags)
|
139 | 168 | {
|
140 | | - TRACE_ENTER(3,14,this,14,lpClipList,9,dwFlags);
|
141 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
142 | | - if(hWnd) TRACE_RET(HRESULT,23,DDERR_CLIPPERISUSINGHWND);
|
| 169 | + TRACE_ENTER(3,14,This,14,lpClipList,9,dwFlags);
|
| 170 | + if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 171 | + if(This->hWnd) TRACE_RET(HRESULT,23,DDERR_CLIPPERISUSINGHWND);
|
143 | 172 | bool memfail;
|
144 | 173 | if(lpClipList)
|
145 | 174 | {
|
— | — | @@ -146,80 +175,81 @@ |
147 | 176 | if(lpClipList->rdh.iType != RDH_RECTANGLES) TRACE_RET(HRESULT,23,DDERR_INVALIDCLIPLIST);
|
148 | 177 | if(lpClipList->rdh.nRgnSize != lpClipList->rdh.nCount * sizeof(RECT))
|
149 | 178 | TRACE_RET(HRESULT,23,DDERR_INVALIDCLIPLIST);
|
150 | | - if(!cliplist)
|
| 179 | + if(!This->cliplist)
|
151 | 180 | {
|
152 | 181 | memfail = false;
|
153 | | - maxsize = lpClipList->rdh.nCount;
|
154 | | - cliplist = (RECT*)malloc(maxsize*sizeof(RECT));
|
155 | | - if(!cliplist) memfail = true;
|
156 | | - if(!memfail) vertices = (BltVertex*)malloc(maxsize*4*sizeof(BltVertex));
|
157 | | - if(!vertices) memfail = true;
|
158 | | - if(!memfail) indices = (WORD*)malloc(maxsize*6*sizeof(WORD));
|
159 | | - if(!indices) memfail = true;
|
| 182 | + This->maxsize = lpClipList->rdh.nCount;
|
| 183 | + This->cliplist = (RECT*)malloc(This->maxsize*sizeof(RECT));
|
| 184 | + if(!This->cliplist) memfail = true;
|
| 185 | + if(!memfail) This->vertices = (BltVertex*)malloc(This->maxsize*4*sizeof(BltVertex));
|
| 186 | + if(!This->vertices) memfail = true;
|
| 187 | + if(!memfail) This->indices = (WORD*)malloc(This->maxsize*6*sizeof(WORD));
|
| 188 | + if(!This->indices) memfail = true;
|
160 | 189 | if(memfail)
|
161 | 190 | {
|
162 | | - if(vertices)
|
| 191 | + if(This->vertices)
|
163 | 192 | {
|
164 | | - free(vertices);
|
165 | | - vertices = NULL;
|
| 193 | + free(This->vertices);
|
| 194 | + This->vertices = NULL;
|
166 | 195 | }
|
167 | | - if(cliplist)
|
| 196 | + if(This->cliplist)
|
168 | 197 | {
|
169 | | - free(cliplist);
|
170 | | - cliplist = NULL;
|
| 198 | + free(This->cliplist);
|
| 199 | + This->cliplist = NULL;
|
171 | 200 | }
|
172 | | - maxsize = 0;
|
| 201 | + This->maxsize = 0;
|
173 | 202 | TRACE_RET(HRESULT,23,DDERR_OUTOFMEMORY);
|
174 | 203 | }
|
175 | 204 | }
|
176 | | - if(lpClipList->rdh.nCount > maxsize)
|
| 205 | + if(lpClipList->rdh.nCount > This->maxsize)
|
177 | 206 | {
|
178 | 207 | memfail = false;
|
179 | 208 | RECT *newcliplist = NULL;
|
180 | 209 | BltVertex *newvertices = NULL;
|
181 | 210 | WORD *newindices = NULL;
|
182 | | - newcliplist = (RECT*)realloc(cliplist,lpClipList->rdh.nCount*sizeof(RECT));
|
| 211 | + newcliplist = (RECT*)realloc(This->cliplist,lpClipList->rdh.nCount*sizeof(RECT));
|
183 | 212 | if(!newcliplist) memfail = true;
|
184 | | - else cliplist = newcliplist;
|
185 | | - if(!memfail) newvertices = (BltVertex*)realloc(vertices,lpClipList->rdh.nCount*4*sizeof(BltVertex));
|
| 213 | + else This->cliplist = newcliplist;
|
| 214 | + if(!memfail) newvertices = (BltVertex*)realloc(This->vertices,lpClipList->rdh.nCount*4*sizeof(BltVertex));
|
186 | 215 | if(!newvertices) memfail = true;
|
187 | | - else vertices = newvertices;
|
188 | | - if(!memfail) newindices = (WORD*)realloc(indices,lpClipList->rdh.nCount*6*sizeof(WORD));
|
| 216 | + else This->vertices = newvertices;
|
| 217 | + if(!memfail) newindices = (WORD*)realloc(This->indices,lpClipList->rdh.nCount*6*sizeof(WORD));
|
189 | 218 | if(!newindices) memfail = true;
|
190 | | - else indices = newindices;
|
| 219 | + else This->indices = newindices;
|
191 | 220 | if(memfail) TRACE_RET(HRESULT,23,DDERR_OUTOFMEMORY);
|
192 | | - maxsize = lpClipList->rdh.nCount;
|
| 221 | + This->maxsize = lpClipList->rdh.nCount;
|
193 | 222 | }
|
194 | | - clipsize = lpClipList->rdh.nCount;
|
195 | | - memcpy(cliplist,lpClipList->Buffer,lpClipList->rdh.nCount*sizeof(RECT));
|
| 223 | + This->clipsize = lpClipList->rdh.nCount;
|
| 224 | + memcpy(This->cliplist,lpClipList->Buffer,lpClipList->rdh.nCount*sizeof(RECT));
|
196 | 225 | for(int i = 0; i < lpClipList->rdh.nCount; i++)
|
197 | 226 | {
|
198 | | - vertices[(i*4)+1].y = vertices[(i*4)+3].y = cliplist[i].left;
|
199 | | - vertices[i*4].x = vertices[(i*4)+2].x = cliplist[i].right;
|
200 | | - vertices[i*4].y = vertices[(i*4)+1].y = cliplist[i].top;
|
201 | | - vertices[(i*4)+2].y = vertices[(i*4)+3].y = cliplist[i].bottom;
|
| 227 | + This->vertices[(i*4)+1].y = This->vertices[(i*4)+3].y = This->cliplist[i].left;
|
| 228 | + This->vertices[i*4].x = This->vertices[(i*4)+2].x = This->cliplist[i].right;
|
| 229 | + This->vertices[i*4].y = This->vertices[(i*4)+1].y = This->cliplist[i].top;
|
| 230 | + This->vertices[(i*4)+2].y = This->vertices[(i*4)+3].y = This->cliplist[i].bottom;
|
202 | 231 | // 0 1 2 2 1 3
|
203 | | - indices[i*6] = i*4;
|
204 | | - indices[(i*6)+1] = indices[(i*6)+4] = (i*4)+1;
|
205 | | - indices[(i*6)+2] = indices[(i*6)+3] = (i*4)+2;
|
206 | | - indices[(i*6)+5] = (i*4)+3;
|
| 232 | + This->indices[i*6] = i*4;
|
| 233 | + This->indices[(i*6)+1] = This->indices[(i*6)+4] = (i*4)+1;
|
| 234 | + This->indices[(i*6)+2] = This->indices[(i*6)+3] = (i*4)+2;
|
| 235 | + This->indices[(i*6)+5] = (i*4)+3;
|
207 | 236 | }
|
208 | 237 | for(int i = 0; i < (4*lpClipList->rdh.nCount); i++)
|
209 | 238 | {
|
210 | | - vertices[i].r = 255;
|
211 | | - vertices[i].g = vertices[i].b = vertices[i].a = 0;
|
212 | | - vertices[i].s = vertices[i].t = 0.0f;
|
| 239 | + This->vertices[i].r = 255;
|
| 240 | + This->vertices[i].g = This->vertices[i].b = This->vertices[i].a = 0;
|
| 241 | + This->vertices[i].s = This->vertices[i].t = 0.0f;
|
213 | 242 | }
|
214 | 243 | }
|
215 | | - else clipsize = 0;
|
| 244 | + else This->clipsize = 0;
|
| 245 | + This->dirty = true;
|
216 | 246 | TRACE_EXIT(23,DD_OK);
|
217 | 247 | return DD_OK;
|
218 | 248 | }
|
219 | | -HRESULT WINAPI glDirectDrawClipper::SetHWnd(DWORD dwFlags, HWND hWnd)
|
| 249 | +HRESULT WINAPI glDirectDrawClipper_SetHWnd(glDirectDrawClipper *This, DWORD dwFlags, HWND hWnd)
|
220 | 250 | {
|
221 | | - TRACE_ENTER(3,14,this,9,dwFlags,13,hWnd);
|
222 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
223 | | - this->hWnd = hWnd;
|
| 251 | + TRACE_ENTER(3,14,This,9,dwFlags,13,hWnd);
|
| 252 | + if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 253 | + This->hWnd = hWnd;
|
224 | 254 | TRACE_EXIT(23,DD_OK);
|
225 | 255 | return DD_OK;
|
226 | 256 | }
|
Index: ddraw/glDirectDrawClipper.h |
— | — | @@ -21,23 +21,11 @@ |
22 | 22 |
|
23 | 23 | class glDirectDraw7;
|
24 | 24 |
|
25 | | -class glDirectDrawClipper : public IDirectDrawClipper
|
| 25 | +struct glDirectDrawClipperVtbl;
|
| 26 | +
|
| 27 | +typedef struct glDirectDrawClipper
|
26 | 28 | {
|
27 | | -public:
|
28 | | - glDirectDrawClipper();
|
29 | | - glDirectDrawClipper(DWORD dwFlags, glDirectDraw7 *parent);
|
30 | | - ~glDirectDrawClipper();
|
31 | | - // ddraw api
|
32 | | - HRESULT WINAPI QueryInterface(REFIID riid, LPVOID* obp);
|
33 | | - ULONG WINAPI AddRef();
|
34 | | - ULONG WINAPI Release();
|
35 | | - HRESULT WINAPI GetClipList(LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize);
|
36 | | - HRESULT WINAPI GetHWnd(HWND FAR *lphWnd);
|
37 | | - HRESULT WINAPI Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags);
|
38 | | - HRESULT WINAPI IsClipListChanged(BOOL FAR *lpbChanged);
|
39 | | - HRESULT WINAPI SetClipList(LPRGNDATA lpClipList, DWORD dwFlags);
|
40 | | - HRESULT WINAPI SetHWnd(DWORD dwFlags, HWND hWnd);
|
41 | | -private:
|
| 29 | + struct glDirectDrawClipperVtbl *lpVtbl;
|
42 | 30 | ULONG refcount;
|
43 | 31 | glDirectDraw7 *glDD7;
|
44 | 32 | bool hasparent;
|
— | — | @@ -49,5 +37,32 @@ |
50 | 38 | int clipsize;
|
51 | 39 | int maxsize;
|
52 | 40 | bool hascliplist;
|
53 | | -};
|
| 41 | +} glDirectDrawClipper;
|
| 42 | +
|
| 43 | +typedef struct glDirectDrawClipperVtbl
|
| 44 | +{
|
| 45 | + HRESULT(WINAPI *QueryInterface)(glDirectDrawClipper *This, REFIID riid, LPVOID* obp);
|
| 46 | + ULONG(WINAPI *AddRef)(glDirectDrawClipper *This);
|
| 47 | + ULONG(WINAPI *Release)(glDirectDrawClipper *This);
|
| 48 | + // ddraw api
|
| 49 | + HRESULT(WINAPI *GetClipList)(glDirectDrawClipper *This, LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize);
|
| 50 | + HRESULT(WINAPI *GetHWnd)(glDirectDrawClipper *This, HWND FAR *lphWnd);
|
| 51 | + HRESULT(WINAPI *Initialize)(glDirectDrawClipper *This, LPDIRECTDRAW lpDD, DWORD dwFlags);
|
| 52 | + HRESULT(WINAPI *IsClipListChanged)(glDirectDrawClipper *This, BOOL FAR *lpbChanged);
|
| 53 | + HRESULT(WINAPI *SetClipList)(glDirectDrawClipper *This, LPRGNDATA lpClipList, DWORD dwFlags);
|
| 54 | + HRESULT(WINAPI *SetHWnd)(glDirectDrawClipper *This, DWORD dwFlags, HWND hWnd);
|
| 55 | +} glDirectDrawClipperVtbl;
|
| 56 | +
|
| 57 | +HRESULT glDirectDrawClipper_CreateNoInit(LPDIRECTDRAWCLIPPER *lplpDDClipper);
|
| 58 | +HRESULT glDirectDrawClipper_Create(DWORD dwFlags, glDirectDraw7 *parent, LPDIRECTDRAWCLIPPER *lplpDDClipper);
|
| 59 | +// ddraw api
|
| 60 | +HRESULT WINAPI glDirectDrawClipper_QueryInterface(glDirectDrawClipper *This, REFIID riid, LPVOID* obp);
|
| 61 | +ULONG WINAPI glDirectDrawClipper_AddRef(glDirectDrawClipper *This);
|
| 62 | +ULONG WINAPI glDirectDrawClipper_Release(glDirectDrawClipper *This);
|
| 63 | +HRESULT WINAPI glDirectDrawClipper_GetClipList(glDirectDrawClipper *This, LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize);
|
| 64 | +HRESULT WINAPI glDirectDrawClipper_GetHWnd(glDirectDrawClipper *This, HWND FAR *lphWnd);
|
| 65 | +HRESULT WINAPI glDirectDrawClipper_Initialize(glDirectDrawClipper *This, LPDIRECTDRAW lpDD, DWORD dwFlags);
|
| 66 | +HRESULT WINAPI glDirectDrawClipper_IsClipListChanged(glDirectDrawClipper *This, BOOL FAR *lpbChanged);
|
| 67 | +HRESULT WINAPI glDirectDrawClipper_SetClipList(glDirectDrawClipper *This, LPRGNDATA lpClipList, DWORD dwFlags);
|
| 68 | +HRESULT WINAPI glDirectDrawClipper_SetHWnd(glDirectDrawClipper *This, DWORD dwFlags, HWND hWnd);
|
54 | 69 | #endif //_GLDIRECTDRAWCLIPPER_H |
\ No newline at end of file |
Index: ddraw/glDirectDrawPalette.c |
— | — | @@ -204,9 +204,9 @@ |
205 | 205 | {
|
206 | 206 | glDirectDrawPalette *newpal;
|
207 | 207 | TRACE_ENTER(3,9,dwFlags,14,lpDDColorArray,14,lplpDDPalette);
|
| 208 | + if (!lplpDDPalette) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
208 | 209 | newpal = (glDirectDrawPalette*)malloc(sizeof(glDirectDrawPalette));
|
209 | | - if (!lplpDDPalette) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
210 | | - if (!newpal) TRACE_RET(HRESULT,23,DDERR_OUTOFMEMORY);
|
| 210 | + if (!newpal) TRACE_RET(HRESULT, 23, DDERR_OUTOFMEMORY);
|
211 | 211 | ZeroMemory(newpal, sizeof(glDirectDrawPalette));
|
212 | 212 | newpal->refcount = 1;
|
213 | 213 | newpal->flags = dwFlags;
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -374,7 +374,7 @@ |
375 | 375 | if(bitmapinfo) free(bitmapinfo);
|
376 | 376 | if(palette) glDirectDrawPalette_Release(palette);
|
377 | 377 | if(backbuffer) backbuffer->Release();
|
378 | | - if(clipper) clipper->Release();
|
| 378 | + if(clipper) glDirectDrawClipper_Release(clipper);
|
379 | 379 | if(buffer) free(buffer);
|
380 | 380 | if(bigbuffer) free(bigbuffer);
|
381 | 381 | if(zbuffer) zbuffer->Release();
|
— | — | @@ -1170,9 +1170,9 @@ |
1171 | 1171 | {
|
1172 | 1172 | TRACE_ENTER(2,14,this,14,lpDDClipper);
|
1173 | 1173 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1174 | | - if(clipper) clipper->Release();
|
| 1174 | + if(clipper) glDirectDrawClipper_Release(clipper);
|
1175 | 1175 | clipper = (glDirectDrawClipper *)lpDDClipper;
|
1176 | | - if(clipper)clipper->AddRef();
|
| 1176 | + if(clipper) glDirectDrawClipper_AddRef(clipper);
|
1177 | 1177 | TRACE_EXIT(23,DD_OK);
|
1178 | 1178 | return DD_OK;
|
1179 | 1179 | }
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | } CKEY;
|
29 | 29 |
|
30 | 30 | class glDirectDraw7;
|
31 | | -class glDirectDrawClipper;
|
| 31 | +struct glDirectDrawClipper;
|
32 | 32 | struct glDirectDrawPalette;
|
33 | 33 | class glDirectDrawSurface1;
|
34 | 34 | class glDirectDrawSurface2;
|