Fix broke SVN after me, thx to it I found wrong ref was release in different place...
[reactos.git] / reactos / lib / ddraw / main / palette_main.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS
5 * FILE: lib/ddraw/main/palette.c
6 * PURPOSE: IDirectDrawPalette Implementation
7 * PROGRAMMER: Maarten Bosma
8 *
9 */
10
11 #include "rosdraw.h"
12
13 ULONG WINAPI
14 Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface)
15 {
16 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
17 ULONG ref = InterlockedIncrement((PLONG)&This->DirectDrawGlobal.dwRefCnt);
18
19 return ref;
20 }
21
22 ULONG WINAPI Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface)
23 {
24 IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
25 ULONG ref = InterlockedDecrement(&This->DirectDrawGlobal.dwRefCnt);
26
27 if (ref == 0)
28 HeapFree(GetProcessHeap(), 0, This);
29
30 return ref;
31 }
32
33 HRESULT WINAPI
34 Main_DirectDrawPalette_Initialize(LPDIRECTDRAWPALETTE iface,
35 LPDIRECTDRAW ddraw, DWORD dwFlags,
36 LPPALETTEENTRY palent)
37 {
38 return DD_OK;
39 }
40
41 HRESULT WINAPI
42 Main_DirectDrawPalette_GetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
43 DWORD dwStart, DWORD dwCount,
44 LPPALETTEENTRY palent)
45 {
46 DX_STUB;
47 }
48
49 HRESULT WINAPI
50 Main_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
51 DWORD dwStart, DWORD dwCount,
52 LPPALETTEENTRY palent)
53 {
54 DX_STUB;
55 }
56 HRESULT WINAPI
57 Main_DirectDrawPalette_GetCaps(LPDIRECTDRAWPALETTE iface, LPDWORD lpdwCaps)
58 {
59 DX_STUB;
60 }
61
62 HRESULT WINAPI
63 Main_DirectDrawPalette_QueryInterface(LPDIRECTDRAWPALETTE iface,
64 REFIID refiid, LPVOID *obj)
65 {
66 return E_NOINTERFACE;
67 }
68
69 IDirectDrawPaletteVtbl DirectDrawPalette_Vtable =
70 {
71 Main_DirectDrawPalette_QueryInterface,
72 Main_DirectDrawPalette_AddRef,
73 Main_DirectDrawPalette_Release,
74 Main_DirectDrawPalette_GetCaps,
75 Main_DirectDrawPalette_GetEntries,
76 Main_DirectDrawPalette_Initialize,
77 Main_DirectDrawPalette_SetEntries
78 };