1 | /* $Id: OS2CLIPPER.CPP,v 1.1 1999-05-24 20:19:36 ktk Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * DirectDraw Clipper Class
|
---|
5 | *
|
---|
6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | *
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | *
|
---|
10 | */
|
---|
11 |
|
---|
12 | /*@Const************************************************************************
|
---|
13 | * Defined Constants *
|
---|
14 | *******************************************************************************/
|
---|
15 | #define INCL_GUID
|
---|
16 | #define WIN32SDK_NOPOSTWRAPPER
|
---|
17 |
|
---|
18 | /*@Header***********************************************************************
|
---|
19 | * Header Files *
|
---|
20 | *******************************************************************************/
|
---|
21 | #include <os2win.h>
|
---|
22 | #include <dive.h>
|
---|
23 |
|
---|
24 | #include <memory.h>
|
---|
25 |
|
---|
26 | #include "no.h"
|
---|
27 | #include <w_windows.h>
|
---|
28 | #include <ddraw.h>
|
---|
29 | #include <d3d.h>
|
---|
30 | #include <Win32SDKPostWrapper.h>
|
---|
31 |
|
---|
32 | #include "os2ddraw.h"
|
---|
33 | #include "os2clipper.h"
|
---|
34 | #include "misc.h"
|
---|
35 |
|
---|
36 | /*** IDirect3D methods ***/
|
---|
37 | /* KSO Apr 19 1999: Set correct interface. *
|
---|
38 | * (INTERFACE is used in the THIS and THIS_ macros) */
|
---|
39 | #undef INTERFACE
|
---|
40 | #define INTERFACE IDirectDrawClipper
|
---|
41 |
|
---|
42 |
|
---|
43 | //******************************************************************************
|
---|
44 | //******************************************************************************
|
---|
45 | OS2IDirectDrawClipper::OS2IDirectDrawClipper(OS2IDirectDraw *lpDirectDraw) :
|
---|
46 | Referenced(0), lastError(DD_OK),
|
---|
47 | clipWindow(0)
|
---|
48 | {
|
---|
49 | lpVtbl = &Vtbl;
|
---|
50 | Vtbl.AddRef = ClipAddRef;
|
---|
51 | Vtbl.Release = ClipRelease;
|
---|
52 | Vtbl.QueryInterface = ClipQueryInterface;
|
---|
53 | Vtbl.GetClipList = ClipGetClipList;
|
---|
54 | Vtbl.GetHWnd = ClipGetHWnd;
|
---|
55 | Vtbl.Initialize = ClipInitialize;
|
---|
56 | Vtbl.IsClipListChanged = ClipIsClipListChanged;
|
---|
57 | Vtbl.SetClipList = ClipSetClipList;
|
---|
58 | Vtbl.SetHWnd = ClipSetHWnd;
|
---|
59 |
|
---|
60 | lpDraw = lpDirectDraw;
|
---|
61 | lpDraw->Vtbl.AddRef((IDirectDraw2*)lpDraw);
|
---|
62 | hDive = lpDirectDraw->GetDiveInstance();
|
---|
63 | }
|
---|
64 | //******************************************************************************
|
---|
65 | //******************************************************************************
|
---|
66 | OS2IDirectDrawClipper::~OS2IDirectDrawClipper()
|
---|
67 | {
|
---|
68 | lpDraw->Vtbl.Release((IDirectDraw2*)lpDraw);
|
---|
69 | }
|
---|
70 | //******************************************************************************
|
---|
71 | //******************************************************************************
|
---|
72 | HRESULT __stdcall ClipQueryInterface(THIS_ REFIID riid, LPVOID FAR * ppvObj)
|
---|
73 | {
|
---|
74 | dprintf(("ClipQueryInterface\n"));
|
---|
75 | *ppvObj = NULL;
|
---|
76 |
|
---|
77 | if(!IsEqualGUID(riid, IID_IDirectDrawClipper) &&
|
---|
78 | !IsEqualGUID(riid, CLSID_DirectDrawClipper))
|
---|
79 | //&& !IsEqualGUID(riid, IID_IUnknown))
|
---|
80 | return E_NOINTERFACE;
|
---|
81 |
|
---|
82 | *ppvObj = This;
|
---|
83 |
|
---|
84 | ClipAddRef(This);
|
---|
85 | return(DD_OK);
|
---|
86 | }
|
---|
87 | //******************************************************************************
|
---|
88 | //******************************************************************************
|
---|
89 | ULONG __stdcall ClipAddRef(THIS)
|
---|
90 | {
|
---|
91 | OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
|
---|
92 |
|
---|
93 | dprintf(("OS2IDirectDrawClipper::AddRef %d\n", me->Referenced+1));
|
---|
94 | return ++me->Referenced;
|
---|
95 | }
|
---|
96 | //******************************************************************************
|
---|
97 | //******************************************************************************
|
---|
98 | ULONG __stdcall ClipRelease(THIS)
|
---|
99 | {
|
---|
100 | OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
|
---|
101 |
|
---|
102 | dprintf(("OS2IDirectDrawClipper::Release %d\n", me->Referenced-1));
|
---|
103 | if(me->Referenced) {
|
---|
104 | me->Referenced--;
|
---|
105 | if(me->Referenced == 0) {
|
---|
106 | delete me;
|
---|
107 | return(0);
|
---|
108 | }
|
---|
109 | else return me->Referenced;
|
---|
110 | }
|
---|
111 | else return(0);
|
---|
112 | }
|
---|
113 | //******************************************************************************
|
---|
114 | //******************************************************************************
|
---|
115 | HRESULT __stdcall ClipGetClipList(THIS_ W32_LPRECT, W32_LPRGNDATA, LPDWORD)
|
---|
116 | {
|
---|
117 | dprintf(("ClipGetClipList\n"));
|
---|
118 | return(DD_OK);
|
---|
119 | }
|
---|
120 | //******************************************************************************
|
---|
121 | //******************************************************************************
|
---|
122 | HRESULT __stdcall ClipGetHWnd(THIS_ W32_HWND FAR *pHwnd)
|
---|
123 | {
|
---|
124 | OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
|
---|
125 |
|
---|
126 | dprintf(("ClipGetHWnd\n"));
|
---|
127 | *pHwnd = me->clipWindow;
|
---|
128 | return(DD_OK);
|
---|
129 | }
|
---|
130 | //******************************************************************************
|
---|
131 | //******************************************************************************
|
---|
132 | HRESULT __stdcall ClipInitialize(THIS_ LPDIRECTDRAW, DWORD)
|
---|
133 | {
|
---|
134 | dprintf(("ClipInitialize\n"));
|
---|
135 | return(DD_OK);
|
---|
136 | }
|
---|
137 | //******************************************************************************
|
---|
138 | //******************************************************************************
|
---|
139 | HRESULT __stdcall ClipIsClipListChanged(THIS_ BOOL FAR *)
|
---|
140 | {
|
---|
141 | dprintf(("ClipIsClipListChanged\n"));
|
---|
142 | return(DD_OK);
|
---|
143 | }
|
---|
144 | //******************************************************************************
|
---|
145 | //******************************************************************************
|
---|
146 | HRESULT __stdcall ClipSetClipList(THIS_ W32_LPRGNDATA,DWORD)
|
---|
147 | {
|
---|
148 | dprintf(("ClipSetClipList\n"));
|
---|
149 | return(DD_OK);
|
---|
150 | }
|
---|
151 | //******************************************************************************
|
---|
152 | //DWORD param not used in DirectX 3
|
---|
153 | //******************************************************************************
|
---|
154 | HRESULT __stdcall ClipSetHWnd(THIS_ DWORD reserved, W32_HWND hwnd)
|
---|
155 | {
|
---|
156 | OS2IDirectDrawClipper *me = (OS2IDirectDrawClipper *)This;
|
---|
157 |
|
---|
158 | dprintf(("ClipSetHWnd\n"));
|
---|
159 | me->clipWindow = hwnd;
|
---|
160 | return(DD_OK);
|
---|
161 | }
|
---|
162 | //******************************************************************************
|
---|
163 | //******************************************************************************
|
---|