Author: khornicek Date: Wed Oct 28 17:03:10 2009 New Revision: 43813
URL: http://svn.reactos.org/svn/reactos?rev=43813&view=rev Log: - preparation for initial palette support
Added: branches/reactx/reactos/dll/directx/ddraw/Vtable/DirectDrawPalette_Vtable.c (with props) Modified: branches/reactx/reactos/dll/directx/ddraw/Palette/palette_main.c branches/reactx/reactos/dll/directx/ddraw/Palette/palette_stubs.c branches/reactx/reactos/dll/directx/ddraw/ddraw.rbuild
Modified: branches/reactx/reactos/dll/directx/ddraw/Palette/palette_main.c URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/directx/ddraw... ============================================================================== --- branches/reactx/reactos/dll/directx/ddraw/Palette/palette_main.c [iso-8859-1] (original) +++ branches/reactx/reactos/dll/directx/ddraw/Palette/palette_main.c [iso-8859-1] Wed Oct 28 17:03:10 2009 @@ -4,9 +4,111 @@ * PROJECT: ReactOS DirectX * FILE: ddraw/Palette/palette.c * PURPOSE: IDirectDrawPalette Implementation - * PROGRAMMER: + * PROGRAMMER: Kamil Hornicek * */
#include "rosdraw.h"
+LPDDRAWI_DDRAWPALETTE_INT +internal_directdrawpalette_int_alloc(LPDDRAWI_DDRAWPALETTE_INT This) +{ + LPDDRAWI_DDRAWPALETTE_INT newThis; + DxHeapMemAlloc(newThis, sizeof(DDRAWI_DDRAWPALETTE_INT)); + if (newThis) + { + newThis->lpLcl = This->lpLcl; + newThis->lpLink = This; + } + + return newThis; +} + +ULONG WINAPI +Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface) +{ + LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; + ULONG ref = 0; + + AcquireDDThreadLock(); + + _SEH2_TRY + { + ref = ++This->dwIntRefCnt; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + } + _SEH2_END + + ReleaseDDThreadLock(); + + return ref; +} + +HRESULT WINAPI +Main_DirectDrawPalette_QueryInterface(LPDIRECTDRAWPALETTE iface, REFIID refiid, LPVOID *ppObj) +{ + HRESULT retVal = DD_OK; + *ppObj = NULL; + LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT) iface; + + DX_WINDBG_trace(); + + _SEH2_TRY + { + if (IsEqualGUID(refiid, &IID_IUnknown) || IsEqualGUID(refiid, &IID_IDirectDrawPalette)) + { + if (This->lpVtbl != &DirectDrawPalette_Vtable) + { + This = internal_directdrawpalette_int_alloc(This); + if (!This) + { + retVal = DDERR_OUTOFVIDEOMEMORY; + _SEH2_LEAVE; + } + } + This->lpVtbl = &DirectDrawPalette_Vtable; + *ppObj = This; + Main_DirectDrawPalette_AddRef((LPDIRECTDRAWPALETTE)This); + } + else + { + DX_STUB_str("E_NOINTERFACE\n"); + retVal = E_NOINTERFACE; + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + } + _SEH2_END; + + return retVal; +} + +ULONG WINAPI +Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface) +{ + ULONG ref = 0; + LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface; + + AcquireDDThreadLock(); + + _SEH2_TRY + { + This->dwIntRefCnt--; + ref = This->dwIntRefCnt; + if(ref == 0) + { + DxHeapMemFree(This); + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + } + _SEH2_END + + ReleaseDDThreadLock(); + + return ref; +}
Modified: branches/reactx/reactos/dll/directx/ddraw/Palette/palette_stubs.c URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/directx/ddraw... ============================================================================== --- branches/reactx/reactos/dll/directx/ddraw/Palette/palette_stubs.c [iso-8859-1] (original) +++ branches/reactx/reactos/dll/directx/ddraw/Palette/palette_stubs.c [iso-8859-1] Wed Oct 28 17:03:10 2009 @@ -10,24 +10,8 @@
#include "rosdraw.h"
-ULONG WINAPI -DirectDrawPalette_Release( LPDIRECTDRAWPALETTE iface) -{ - DX_WINDBG_trace(); - - DX_STUB; -} - -ULONG WINAPI -DirectDrawPalette_AddRef( LPDIRECTDRAWPALETTE iface) -{ - DX_WINDBG_trace(); - - DX_STUB; -} - HRESULT WINAPI -DirectDrawPalette_Initialize( LPDIRECTDRAWPALETTE iface, +Main_DirectDrawPalette_Initialize( LPDIRECTDRAWPALETTE iface, LPDIRECTDRAW ddraw, DWORD dwFlags, LPPALETTEENTRY palent) @@ -37,7 +21,7 @@ }
HRESULT WINAPI -DirectDrawPalette_GetEntries( LPDIRECTDRAWPALETTE iface, +Main_DirectDrawPalette_GetEntries( LPDIRECTDRAWPALETTE iface, DWORD dwFlags, DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent) @@ -47,7 +31,7 @@ }
HRESULT WINAPI -DirectDrawPalette_SetEntries( LPDIRECTDRAWPALETTE iface, +Main_DirectDrawPalette_SetEntries( LPDIRECTDRAWPALETTE iface, DWORD dwFlags, DWORD dwStart, DWORD dwCount, @@ -57,29 +41,9 @@ DX_STUB; } HRESULT WINAPI -DirectDrawPalette_GetCaps( LPDIRECTDRAWPALETTE iface, +Main_DirectDrawPalette_GetCaps( LPDIRECTDRAWPALETTE iface, LPDWORD lpdwCaps) { DX_WINDBG_trace(); DX_STUB; } - -HRESULT WINAPI -DirectDrawPalette_QueryInterface( LPDIRECTDRAWPALETTE iface, - REFIID refiid, - LPVOID *obj) -{ - DX_WINDBG_trace(); - DX_STUB; -} - -IDirectDrawPaletteVtbl DirectDrawPalette_Vtable = -{ - DirectDrawPalette_QueryInterface, - DirectDrawPalette_AddRef, - DirectDrawPalette_Release, - DirectDrawPalette_GetCaps, - DirectDrawPalette_GetEntries, - DirectDrawPalette_Initialize, - DirectDrawPalette_SetEntries -};
Added: branches/reactx/reactos/dll/directx/ddraw/Vtable/DirectDrawPalette_Vtable.c URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/directx/ddraw... ============================================================================== --- branches/reactx/reactos/dll/directx/ddraw/Vtable/DirectDrawPalette_Vtable.c (added) +++ branches/reactx/reactos/dll/directx/ddraw/Vtable/DirectDrawPalette_Vtable.c [iso-8859-1] Wed Oct 28 17:03:10 2009 @@ -1,0 +1,36 @@ +#include <windows.h> +#include <stdio.h> +#include <ddraw.h> +#include <ddrawi.h> +#include <d3dhal.h> +#include <ddrawgdi.h> + +#if defined(_WIN32) && !defined(_NO_COM ) +#define COM_NO_WINDOWS_H +#include <objbase.h> +#else +#define IUnknown void +#if !defined(NT_BUILD_ENVIRONMENT) && !defined(WINNT) + #define CO_E_NOTINITIALIZED 0x800401F0 +#endif +#endif + +ULONG WINAPI Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface); +ULONG WINAPI Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface); +HRESULT WINAPI Main_DirectDrawPalette_Initialize(LPDIRECTDRAWPALETTE iface, LPDIRECTDRAW ddraw, DWORD dwFlags, LPPALETTEENTRY palent); +HRESULT WINAPI Main_DirectDrawPalette_GetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags, DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent); +HRESULT WINAPI Main_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags, DWORD dwStart, DWORD dwCount, LPPALETTEENTRY palent); +HRESULT WINAPI Main_DirectDrawPalette_GetCaps(LPDIRECTDRAWPALETTE iface, LPDWORD lpdwCaps); +HRESULT WINAPI Main_DirectDrawPalette_QueryInterface(LPDIRECTDRAWPALETTE iface, REFIID refiid, LPVOID *obj); + +IDirectDrawPaletteVtbl DirectDrawPalette_Vtable = +{ + Main_DirectDrawPalette_QueryInterface, + Main_DirectDrawPalette_AddRef, + Main_DirectDrawPalette_Release, + Main_DirectDrawPalette_GetCaps, + Main_DirectDrawPalette_GetEntries, + Main_DirectDrawPalette_Initialize, + Main_DirectDrawPalette_SetEntries +}; +
Propchange: branches/reactx/reactos/dll/directx/ddraw/Vtable/DirectDrawPalette_Vtable.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/reactx/reactos/dll/directx/ddraw/ddraw.rbuild URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/directx/ddraw... ============================================================================== --- branches/reactx/reactos/dll/directx/ddraw/ddraw.rbuild [iso-8859-1] (original) +++ branches/reactx/reactos/dll/directx/ddraw/ddraw.rbuild [iso-8859-1] Wed Oct 28 17:03:10 2009 @@ -61,6 +61,7 @@ <file>DirectDraw4_Vtable.c</file> <file>DirectDraw2_Vtable.c</file> <file>DirectDraw_Vtable.c</file> + <file>DirectDrawPalette_Vtable.c</file> <file>DirectDrawSurface7_Vtable.c</file> <file>DirectDrawSurface4_Vtable.c</file> <file>DirectDrawSurface3_Vtable.c</file>