source: trunk/src/ddraw/new/os2clipper.cpp@ 21916

Last change on this file since 21916 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

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