ReactOS 0.4.15-dev-8219-ge8b88cf
palette.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS DirectX
4 * FILE: dll/directx/ddraw/Palette/palette.c
5 * PURPOSE: IDirectDrawPalette Implementation
6 * PROGRAMMER: Jérôme Gardou
7 *
8 */
9
10#include "rosdraw.h"
11
12/*****************************************************************************
13 * IDirectDrawPalette::QueryInterface
14 *
15 * A usual QueryInterface implementation. Can only Query IUnknown and
16 * IDirectDrawPalette
17 *
18 * Params:
19 * refiid: The interface id queried for
20 * obj: Address to return the interface pointer at
21 *
22 * Returns:
23 * S_OK on success
24 * E_NOINTERFACE if the requested interface wasn't found
25 *****************************************************************************/
26static HRESULT WINAPI
27DirectDrawPalette_QueryInterface(IDirectDrawPalette *iface,
28 REFIID refiid,
29 void **obj)
30{
31 if (IsEqualGUID(refiid, &IID_IUnknown)
32 || IsEqualGUID(refiid, &IID_IDirectDrawPalette))
33 {
34 *obj = iface;
35 IDirectDrawPalette_AddRef(iface);
36 return S_OK;
37 }
38 else
39 {
40 *obj = NULL;
41 return E_NOINTERFACE;
42 }
43}
44
45/*****************************************************************************
46 * IDirectDrawPaletteImpl::AddRef
47 *
48 * Increases the refcount.
49 *
50 * Returns:
51 * The new refcount
52 *
53 *****************************************************************************/
54static ULONG WINAPI
55DirectDrawPalette_AddRef(IDirectDrawPalette *iface)
56{
58 ULONG ref = 0;
59
61 {
62 ref = ++This->dwIntRefCnt;
63 }
65 {
66 }
68
69 return ref;
70}
71
72/*****************************************************************************
73 * IDirectDrawPaletteImpl::Release
74 *
75 * Reduces the refcount. If the refcount falls to 0, the object is destroyed
76 *
77 * Returns:
78 * The new refcount
79 *
80 *****************************************************************************/
81static ULONG WINAPI
82DirectDrawPalette_Release(IDirectDrawPalette *iface)
83{
85 ULONG ref = 0;
86
88 {
89 ref = --This->dwIntRefCnt;
90 if(ref == 0)
91 {
93 if(((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw7_Vtable
94 || ((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw4_Vtable)
96 DxHeapMemFree(This); //HUGE FIXME!!!
98 }
99 }
101 {
102 }
104
105 return ref;
106}
107
108static HRESULT WINAPI
112 LPPALETTEENTRY palent)
113{
115 DX_STUB;
116}
117
118static HRESULT WINAPI
121 DWORD dwStart, DWORD dwCount,
122 LPPALETTEENTRY palent)
123{
125 DX_STUB;
126}
127
128static HRESULT WINAPI
131 DWORD dwStart,
132 DWORD dwCount,
133 LPPALETTEENTRY palent)
134{
136 DX_STUB;
137}
138
139static HRESULT WINAPI
141 LPDWORD lpdwCaps)
142{
144 DX_STUB;
145}
146
147const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable =
148{
156};
const GUID IID_IUnknown
struct _DDRAWI_DDRAWPALETTE_INT * LPDDRAWI_DDRAWPALETTE_INT
Definition: ddrawi.h:142
#define NULL
Definition: types.h:112
ULONG WINAPI Main_DirectDraw_Release(LPDDRAWI_DIRECTDRAW_INT This)
Definition: ddraw_main.c:194
static HRESULT WINAPI DirectDrawPalette_Initialize(LPDIRECTDRAWPALETTE iface, LPDIRECTDRAW ddraw, DWORD dwFlags, LPPALETTEENTRY palent)
Definition: palette.c:109
const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable
Definition: palette.c:147
static ULONG WINAPI DirectDrawPalette_AddRef(IDirectDrawPalette *iface)
Definition: palette.c:55
static ULONG WINAPI DirectDrawPalette_Release(IDirectDrawPalette *iface)
Definition: palette.c:82
static HRESULT WINAPI DirectDrawPalette_GetCaps(LPDIRECTDRAWPALETTE iface, LPDWORD lpdwCaps)
Definition: palette.c:140
static HRESULT WINAPI DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags, DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent)
Definition: palette.c:129
static HRESULT WINAPI DirectDrawPalette_GetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags, DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent)
Definition: palette.c:119
static HRESULT WINAPI DirectDrawPalette_QueryInterface(IDirectDrawPalette *iface, REFIID refiid, void **obj)
Definition: palette.c:27
VOID WINAPI AcquireDDThreadLock()
Definition: main.c:412
VOID WINAPI ReleaseDDThreadLock()
Definition: main.c:421
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned long DWORD
Definition: ntddk_ex.h:95
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define S_OK
Definition: intsafe.h:52
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
IDirectDraw7Vtbl DirectDraw7_Vtable
#define DX_STUB
Definition: rosdraw.h:224
IDirectDraw4Vtbl DirectDraw4_Vtable
Definition: ddraw_thunk.c:890
#define DxHeapMemFree(p)
Definition: rosdraw.h:120
#define DX_WINDBG_trace()
Definition: rosdraw.h:262
struct IDirectDraw * LPDIRECTDRAW
Definition: ddraw.h:710
struct IDirectDrawPalette * LPDIRECTDRAWPALETTE
Definition: ddraw.h:720
Definition: send.c:48
uint32_t * LPDWORD
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364