source: trunk/src/ddraw/OS2CLIPPER.CPP@ 503

Last change on this file since 503 was 503, checked in by hugh, 26 years ago

Changed to use ODINCRT macros to preserve FS, but still does crash

File size: 4.9 KB
Line 
1#include <memory.h>
2
3#define INITGUID
4#include "os2ddraw.h"
5#include "os2clipper.h"
6#define _OS2WIN_H
7#define FAR
8#include "misc.h"
9#include <winerror.h>
10#include <odincrt.h>
11
12//******************************************************************************
13//******************************************************************************
14OS2IDirectDrawClipper::OS2IDirectDrawClipper(OS2IDirectDraw *lpDirectDraw) :
15 Referenced(0), lastError(DD_OK),
16 clipWindow(0)
17{
18 lpVtbl = &Vtbl;
19 Vtbl.AddRef = ClipAddRef;
20 Vtbl.Release = ClipRelease;
21 Vtbl.QueryInterface = ClipQueryInterface;
22 Vtbl.GetClipList = ClipGetClipList;
23 Vtbl.GetHWnd = ClipGetHWnd;
24 Vtbl.Initialize = ClipInitialize;
25 Vtbl.IsClipListChanged = ClipIsClipListChanged;
26 Vtbl.SetClipList = ClipSetClipList;
27 Vtbl.SetHWnd = ClipSetHWnd;
28
29 lpDraw = lpDirectDraw;
30 lpDraw->Vtbl.AddRef(lpDraw);
31 hDive = lpDirectDraw->GetDiveInstance();
32}
33//******************************************************************************
34//******************************************************************************
35OS2IDirectDrawClipper::~OS2IDirectDrawClipper()
36{
37 lpDraw->Vtbl.Release(lpDraw);
38}
39//******************************************************************************
40//******************************************************************************
41HRESULT __stdcall ClipQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj)
42{
43 #ifdef DEBUG
44 WriteLog("ClipQueryInterface\n");
45 #endif
46
47 *ppvObj = NULL;
48
49 if(!IsEqualGUID(riid, IID_IDirectDrawClipper) &&
50 !IsEqualGUID(riid, CLSID_DirectDrawClipper))
51//&& !IsEqualGUID(riid, IID_IUnknown))
52 return E_NOINTERFACE;
53
54 *ppvObj = This;
55
56 ClipAddRef(This);
57 return(DD_OK);
58}
59//******************************************************************************
60//******************************************************************************
61ULONG __stdcall ClipAddRef(THIS This)
62{
63 OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
64
65 #ifdef DEBUG
66 WriteLog("OS2IDirectDrawClipper::AddRef %d\n", me->Referenced+1);
67 #endif
68
69 return ++me->Referenced;
70}
71//******************************************************************************
72//******************************************************************************
73ULONG __stdcall ClipRelease(THIS This)
74{
75 OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
76
77 #ifdef DEBUG
78 WriteLog("OS2IDirectDrawClipper::Release %d\n", me->Referenced-1);
79 #endif
80
81 if(me->Referenced)
82 {
83 me->Referenced--;
84 if(me->Referenced == 0)
85 {
86 ODIN_delete( me);
87 return(0);
88 }
89 else
90 return me->Referenced;
91 }
92 else
93 return(0);
94}
95//******************************************************************************
96//******************************************************************************
97HRESULT __stdcall ClipGetClipList(THIS, LPRECT, LPRGNDATA, LPDWORD)
98{
99 #ifdef DEBUG
100 WriteLog("ClipGetClipList\n");
101 #endif
102
103 return(DD_OK);
104}
105//******************************************************************************
106//******************************************************************************
107HRESULT __stdcall ClipGetHWnd(THIS This, HWND FAR *pHwnd)
108{
109 OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
110
111 #ifdef DEBUG
112 WriteLog("ClipGetHWnd\n");
113 #endif
114
115 *pHwnd = me->clipWindow;
116 return(DD_OK);
117}
118//******************************************************************************
119//******************************************************************************
120HRESULT __stdcall ClipInitialize(THIS, LPDIRECTDRAW, DWORD)
121{
122 #ifdef DEBUG
123 WriteLog("ClipInitialize\n");
124 #endif
125
126 return(DDERR_ALREADYINITIALIZED); // Init is done during creation see M$ Doc
127}
128//******************************************************************************
129//******************************************************************************
130HRESULT __stdcall ClipIsClipListChanged(THIS, BOOL FAR *)
131{
132 #ifdef DEBUG
133 WriteLog("ClipIsClipListChanged\n");
134 #endif
135
136 return(DD_OK);
137}
138//******************************************************************************
139//******************************************************************************
140HRESULT __stdcall ClipSetClipList(THIS, LPRGNDATA,DWORD)
141{
142 #ifdef DEBUG
143 WriteLog("ClipSetClipList\n");
144 #endif
145
146 return(DD_OK);
147}
148//******************************************************************************
149//DWORD param not used in DirectX 3
150//******************************************************************************
151HRESULT __stdcall ClipSetHWnd(THIS This, DWORD reserved, HWND hwnd)
152{
153 OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
154
155 #ifdef DEBUG
156 WriteLog("ClipSetHWnd\n");
157 #endif
158
159 me->clipWindow = hwnd;
160 return(DD_OK);
161}
162//******************************************************************************
163//******************************************************************************
Note: See TracBrowser for help on using the repository browser.