Index: ddraw/glDirectDraw.cpp |
— | — | @@ -861,6 +861,19 @@ |
862 | 862 | }
|
863 | 863 | HRESULT WINAPI glDirectDraw7::CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
|
864 | 864 | {
|
| 865 | + TRACE_ENTER(4, 14, this, 9, dwFlags, 14, lplpDDClipper, 14, pUnkOuter);
|
| 866 | + if (!this) TRACE_RET(HRESULT, 23, DDERR_INVALIDOBJECT);
|
| 867 | + HRESULT ret = CreateClipper2(dwFlags, lplpDDClipper, pUnkOuter);
|
| 868 | + if (ret == DD_OK)
|
| 869 | + {
|
| 870 | + this->AddRef();
|
| 871 | + ((glDirectDrawClipper*)lplpDDClipper)->creator = this;
|
| 872 | + }
|
| 873 | + TRACE_EXIT(23, ret);
|
| 874 | + return ret;
|
| 875 | +}
|
| 876 | +HRESULT glDirectDraw7::CreateClipper2(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter)
|
| 877 | +{
|
865 | 878 | TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
|
866 | 879 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
867 | 880 | if(!lplpDDClipper) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
— | — | @@ -875,7 +888,7 @@ |
876 | 889 | ZeroMemory(&clippers[clippercountmax],1024*sizeof(glDirectDrawClipper *));
|
877 | 890 | clippercountmax += 1024;
|
878 | 891 | }
|
879 | | - TRACE_RET(HRESULT, 23, glDirectDrawClipper_Create(dwFlags, this, lplpDDClipper));
|
| 892 | + TRACE_RET(HRESULT,23,glDirectDrawClipper_Create(dwFlags, this, lplpDDClipper));
|
880 | 893 | }
|
881 | 894 | HRESULT WINAPI glDirectDraw7::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
|
882 | 895 | {
|
— | — | @@ -2010,7 +2023,14 @@ |
2011 | 2024 | {
|
2012 | 2025 | TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
|
2013 | 2026 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2014 | | - TRACE_RET(HRESULT,23,glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter));
|
| 2027 | + HRESULT ret = glDD7->CreateClipper2(dwFlags, lplpDDClipper, pUnkOuter);
|
| 2028 | + if (ret == DD_OK)
|
| 2029 | + {
|
| 2030 | + this->AddRef();
|
| 2031 | + ((glDirectDrawClipper*)lplpDDClipper)->creator = this;
|
| 2032 | + }
|
| 2033 | + TRACE_EXIT(23, ret);
|
| 2034 | + return ret;
|
2015 | 2035 | }
|
2016 | 2036 | HRESULT WINAPI glDirectDraw1::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
|
2017 | 2037 | {
|
— | — | @@ -2204,7 +2224,14 @@ |
2205 | 2225 | {
|
2206 | 2226 | TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
|
2207 | 2227 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2208 | | - TRACE_RET(HRESULT,23,glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter));
|
| 2228 | + HRESULT ret = glDD7->CreateClipper2(dwFlags, lplpDDClipper, pUnkOuter);
|
| 2229 | + if (ret == DD_OK)
|
| 2230 | + {
|
| 2231 | + this->AddRef();
|
| 2232 | + ((glDirectDrawClipper*)lplpDDClipper)->creator = this;
|
| 2233 | + }
|
| 2234 | + TRACE_EXIT(23, ret);
|
| 2235 | + return ret;
|
2209 | 2236 | }
|
2210 | 2237 | HRESULT WINAPI glDirectDraw2::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
|
2211 | 2238 | {
|
— | — | @@ -2422,7 +2449,14 @@ |
2423 | 2450 | {
|
2424 | 2451 | TRACE_ENTER(4,14,this,9,dwFlags,14,lplpDDClipper,14,pUnkOuter);
|
2425 | 2452 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2426 | | - TRACE_RET(HRESULT,23,glDD7->CreateClipper(dwFlags,lplpDDClipper,pUnkOuter));
|
| 2453 | + HRESULT ret = glDD7->CreateClipper2(dwFlags, lplpDDClipper, pUnkOuter);
|
| 2454 | + if (ret == DD_OK)
|
| 2455 | + {
|
| 2456 | + this->AddRef();
|
| 2457 | + ((glDirectDrawClipper*)lplpDDClipper)->creator = this;
|
| 2458 | + }
|
| 2459 | + TRACE_EXIT(23, ret);
|
| 2460 | + return ret;
|
2427 | 2461 | }
|
2428 | 2462 | HRESULT WINAPI glDirectDraw4::CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter)
|
2429 | 2463 | {
|
Index: ddraw/glDirectDraw.h |
— | — | @@ -88,7 +88,8 @@ |
89 | 89 | ULONG WINAPI AddRef1();
|
90 | 90 | ULONG WINAPI Release1();
|
91 | 91 | HRESULT CreateSurface2(LPDDSURFACEDESC2 lpDDSurfaceDesc2, LPDIRECTDRAWSURFACE7 FAR *lplpDDSurface, IUnknown FAR *pUnkOuter, BOOL RecordSurface);
|
92 | | - HRESULT err() {return error;}
|
| 92 | + HRESULT CreateClipper2(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter);
|
| 93 | + HRESULT err() { return error; }
|
93 | 94 | void RemoveSurface(glDirectDrawSurface7 *surface);
|
94 | 95 | void GetSizes(LONG *sizes);
|
95 | 96 | DWORD GetBPP(){return primarybpp;}
|
Index: ddraw/glDirectDrawClipper.cpp |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | newclipper->refcount = 1;
|
47 | 47 | newclipper->initialized = false;
|
48 | 48 | newclipper->lpVtbl = &glDirectDrawClipper_iface;
|
| 49 | + newclipper->creator = NULL;
|
49 | 50 | if (lplpDDClipper) *lplpDDClipper = (LPDIRECTDRAWCLIPPER)newclipper;
|
50 | 51 | TRACE_EXIT(23, DD_OK);
|
51 | 52 | return DD_OK;
|
— | — | @@ -61,6 +62,7 @@ |
62 | 63 | newclipper->refcount = 1;
|
63 | 64 | newclipper->initialized = false;
|
64 | 65 | newclipper->lpVtbl = &glDirectDrawClipper_iface;
|
| 66 | + newclipper->creator = NULL;
|
65 | 67 | glDirectDrawClipper_Initialize(newclipper, (LPDIRECTDRAW)parent, dwFlags);
|
66 | 68 | if (lplpDDClipper) *lplpDDClipper = (LPDIRECTDRAWCLIPPER)newclipper;
|
67 | 69 | TRACE_EXIT(23, DD_OK);
|
— | — | @@ -112,6 +114,7 @@ |
113 | 115 | if (This->vertices) free(This->vertices);
|
114 | 116 | if (This->indices) free(This->indices);
|
115 | 117 | if (This->glDD7) This->glDD7->DeleteClipper(This);
|
| 118 | + if (This->creator) This->creator->Release();
|
116 | 119 | free(This);
|
117 | 120 | };
|
118 | 121 | TRACE_EXIT(8,ret);
|
Index: ddraw/glDirectDrawClipper.h |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | int maxsize;
|
40 | 40 | bool hascliplist;
|
41 | 41 | bool dirty;
|
| 42 | + IUnknown *creator;
|
42 | 43 | } glDirectDrawClipper;
|
43 | 44 |
|
44 | 45 | typedef struct glDirectDrawClipperVtbl
|