ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

palette.c
Go to the documentation of this file.
00001 /* $Id: palette.c $
00002  *
00003  * COPYRIGHT:            See COPYING in the top level directory
00004  * PROJECT:              ReactOS DirectX
00005  * FILE:                 ddraw/Palette/palette.c
00006  * PURPOSE:              IDirectDrawPalette Implementation
00007  * PROGRAMMER:           Jérôme Gardou
00008  *
00009  */
00010 
00011 #include "rosdraw.h"
00012 
00013 /*****************************************************************************
00014  * IDirectDrawPalette::QueryInterface
00015  *
00016  * A usual QueryInterface implementation. Can only Query IUnknown and
00017  * IDirectDrawPalette
00018  *
00019  * Params:
00020  *  refiid: The interface id queried for
00021  *  obj: Address to return the interface pointer at
00022  *
00023  * Returns:
00024  *  S_OK on success
00025  *  E_NOINTERFACE if the requested interface wasn't found
00026  *****************************************************************************/
00027 static HRESULT WINAPI
00028 DirectDrawPalette_QueryInterface(IDirectDrawPalette *iface,
00029                                       REFIID refiid,
00030                                       void **obj)
00031 {
00032     if (IsEqualGUID(refiid, &IID_IUnknown)
00033         || IsEqualGUID(refiid, &IID_IDirectDrawPalette))
00034     {
00035         *obj = iface;
00036         IDirectDrawPalette_AddRef(iface);
00037         return S_OK;
00038     }
00039     else
00040     {
00041         *obj = NULL;
00042         return E_NOINTERFACE;
00043     }
00044 }
00045 
00046 /*****************************************************************************
00047  * IDirectDrawPaletteImpl::AddRef
00048  *
00049  * Increases the refcount.
00050  *
00051  * Returns:
00052  *  The new refcount
00053  *
00054  *****************************************************************************/
00055 static ULONG WINAPI
00056 DirectDrawPalette_AddRef(IDirectDrawPalette *iface)
00057 {
00058     LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface;
00059     ULONG ref = 0;
00060 
00061     _SEH2_TRY
00062     {
00063         ref = ++This->dwIntRefCnt;
00064     }
00065     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
00066     {
00067     }
00068     _SEH2_END
00069 
00070     return ref;
00071 }
00072 
00073 /*****************************************************************************
00074  * IDirectDrawPaletteImpl::Release
00075  *
00076  * Reduces the refcount. If the refcount falls to 0, the object is destroyed
00077  *
00078  * Returns:
00079  *  The new refcount
00080  *
00081  *****************************************************************************/
00082 static ULONG WINAPI
00083 DirectDrawPalette_Release(IDirectDrawPalette *iface)
00084 {
00085     LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface;
00086     ULONG ref = 0;
00087 
00088     _SEH2_TRY
00089     {
00090         ref = --This->dwIntRefCnt;
00091         if(ref == 0)
00092         {
00093             AcquireDDThreadLock();
00094             if(((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw7_Vtable
00095                     || ((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw4_Vtable)
00096                 Main_DirectDraw_Release((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1) ;
00097             DxHeapMemFree(This); //HUGE FIXME!!!
00098             ReleaseDDThreadLock();
00099         }
00100     }
00101     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
00102     {
00103     }
00104     _SEH2_END
00105 
00106     return ref;
00107 }
00108 
00109 static HRESULT WINAPI
00110 DirectDrawPalette_Initialize( LPDIRECTDRAWPALETTE iface,
00111                               LPDIRECTDRAW ddraw,
00112                               DWORD dwFlags,
00113                               LPPALETTEENTRY palent)
00114 {
00115    DX_WINDBG_trace();
00116    DX_STUB;
00117 }
00118 
00119 static HRESULT WINAPI
00120 DirectDrawPalette_GetEntries( LPDIRECTDRAWPALETTE iface,
00121                               DWORD dwFlags,
00122                               DWORD dwStart, DWORD dwCount,
00123                               LPPALETTEENTRY palent)
00124 {
00125    DX_WINDBG_trace();
00126    DX_STUB;
00127 }
00128 
00129 static HRESULT WINAPI
00130 DirectDrawPalette_SetEntries( LPDIRECTDRAWPALETTE iface,
00131                               DWORD dwFlags,
00132                               DWORD dwStart,
00133                               DWORD dwCount,
00134                               LPPALETTEENTRY palent)
00135 {
00136    DX_WINDBG_trace();
00137    DX_STUB;
00138 }
00139 
00140 static HRESULT WINAPI
00141 DirectDrawPalette_GetCaps( LPDIRECTDRAWPALETTE iface,
00142                            LPDWORD lpdwCaps)
00143 {
00144    DX_WINDBG_trace();
00145    DX_STUB;
00146 }
00147 
00148 const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable =
00149 {
00150     DirectDrawPalette_QueryInterface,
00151     DirectDrawPalette_AddRef,
00152     DirectDrawPalette_Release,
00153     DirectDrawPalette_GetCaps,
00154     DirectDrawPalette_GetEntries,
00155     DirectDrawPalette_Initialize,
00156     DirectDrawPalette_SetEntries
00157 };

Generated on Sun May 27 2012 04:17:05 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.