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