[DDRAW] Directory reorganization (part 4)

Christian Costa titan.costa at wanadoo.fr
Thu Jun 2 17:29:43 CDT 2005


Hi,

Changelog:
Moved clipper and palette objects files to ddraw root dir.

Christian Costa   titan.costa at wanadoo.fr

-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.356
diff -u -r1.356 configure.ac
--- configure.ac	24 May 2005 11:52:46 -0000	1.356
+++ configure.ac	2 Jun 2005 21:11:29 -0000
@@ -1508,10 +1508,8 @@
 AH_TOP([#define __WINE_CONFIG_H])
 
 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/d3ddevice)
-WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dclipper)
 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/ddraw)
 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/direct3d)
-WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dpalette)
 WINE_CONFIG_EXTRA_DIR(dlls/ddraw/dsurface)
 WINE_CONFIG_EXTRA_DIR(dlls/gdi/enhmfdrv)
 WINE_CONFIG_EXTRA_DIR(dlls/gdi/mfdrv)
Index: dlls/ddraw/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/Makefile.in,v
retrieving revision 1.35
diff -u -r1.35 Makefile.in
--- dlls/ddraw/Makefile.in	31 May 2005 09:32:44 -0000	1.35
+++ dlls/ddraw/Makefile.in	2 Jun 2005 21:11:30 -0000
@@ -24,14 +24,12 @@
 
 C_SRCS = \
 	@OPENGLFILES@ \
-	dclipper/main.c \
+	clipper.c \
 	ddraw_utils.c \
 	ddraw/hal.c \
 	ddraw/main.c \
 	ddraw/thunks.c \
 	ddraw/user.c \
-	dpalette/hal.c \
-	dpalette/main.c \
 	dsurface/dib.c \
 	dsurface/fakezbuffer.c \
 	dsurface/gamma.c \
@@ -41,6 +39,8 @@
 	dsurface/user.c \
 	dsurface/wndproc.c \
 	main.c \
+	palette_hal.c \
+	palette_main.c \
 	regsvr.c
 
 RC_SRCS = version.rc
@@ -49,10 +49,8 @@
 
 EXTRASUBDIRS = \
 	d3ddevice \
-	dclipper \
 	ddraw \
 	direct3d \
-	dpalette \
 	dsurface
 
 @MAKE_DLL_RULES@
--- dlls/ddraw/dclipper/main.c	2005-06-02 21:37:41.000000000 +0100
+++ /dev/null	1970-01-01 01:00:00.000000000 +0100
@@ -1,285 +0,0 @@
-/*		DirectDrawClipper implementation
- *
- * Copyright 2000 Marcus Meissner
- * Copyright 2000 TransGaming Technologies Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "config.h"
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define CONST_VTABLE
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "ddraw.h"
-#include "winerror.h"
-
-#include "ddraw_private.h"
-
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
-
-/******************************************************************************
- *			DirectDrawCreateClipper (DDRAW.@)
- */
-
-static const IDirectDrawClipperVtbl DDRAW_Clipper_VTable;
-
-HRESULT WINAPI DirectDrawCreateClipper(
-    DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter
-) {
-    IDirectDrawClipperImpl* This;
-    TRACE("(%08lx,%p,%p)\n", dwFlags, lplpDDClipper, pUnkOuter);
-
-    if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
-
-    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-		     sizeof(IDirectDrawClipperImpl));
-    if (This == NULL) return E_OUTOFMEMORY;
-
-    ICOM_INIT_INTERFACE(This, IDirectDrawClipper, DDRAW_Clipper_VTable);
-    This->ref = 1;
-    This->hWnd = 0;
-    This->ddraw_owner = NULL;
-
-    *lplpDDClipper = ICOM_INTERFACE(This, IDirectDrawClipper);
-    return DD_OK;
-}
-
-/* This is the classfactory implementation. */
-HRESULT DDRAW_CreateDirectDrawClipper(IUnknown* pUnkOuter, REFIID riid,
-				      LPVOID* ppObj)
-{
-    HRESULT hr;
-    LPDIRECTDRAWCLIPPER pClip;
-
-    hr = DirectDrawCreateClipper(0, &pClip, pUnkOuter);
-    if (FAILED(hr)) return hr;
-
-    hr = IDirectDrawClipper_QueryInterface(pClip, riid, ppObj);
-    IDirectDrawClipper_Release(pClip);
-    return hr;
-}
-
-/******************************************************************************
- *			IDirectDrawClipper
- */
-HRESULT WINAPI Main_DirectDrawClipper_SetHwnd(
-    LPDIRECTDRAWCLIPPER iface, DWORD dwFlags, HWND hWnd
-) {
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-
-    TRACE("(%p)->(0x%08lx,0x%08lx)\n", This, dwFlags, (DWORD)hWnd);
-    if( dwFlags ) {
-	FIXME("dwFlags = 0x%08lx, not supported.\n",dwFlags);
-	return DDERR_INVALIDPARAMS;
-    }
-
-    This->hWnd = hWnd;
-    return DD_OK;
-}
-
-static void Main_DirectDrawClipper_Destroy(IDirectDrawClipperImpl* This)
-{
-    if (This->ddraw_owner != NULL)
-	Main_DirectDraw_RemoveClipper(This->ddraw_owner, This);
-
-    HeapFree(GetProcessHeap(), 0 ,This);
-}
-
-void Main_DirectDrawClipper_ForceDestroy(IDirectDrawClipperImpl* This)
-{
-    WARN("deleting clipper %p with refcnt %lu\n", This, This->ref);
-    Main_DirectDrawClipper_Destroy(This);
-}
-
-ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) {
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-    ULONG ref = InterlockedDecrement(&This->ref);
-
-    TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1);
-
-    if (ref == 0)
-    {
-	Main_DirectDrawClipper_Destroy(This);
-	return 0;
-    }
-    else return ref;
-}
-
-/***********************************************************************
-*           IDirectDrawClipper::GetClipList
-*
-* Retrieve a copy of the clip list
-*
-* PARAMS
-*  lpRect  Rectangle to be used to clip the clip list or NULL for the
-*          entire clip list
-*  lpClipList structure for the resulting copy of the clip list.
-           If NULL, fills lpdwSize up to the number of bytes necessary to hold
-           the entire clip.
-*  lpdwSize Size of resulting clip list; size of the buffer at lpClipList
-           or, if lpClipList is NULL, receives the required size of the buffer
-           in bytes
-* RETURNS
-*  Either DD_OK or DDERR_*
-*/
-HRESULT WINAPI Main_DirectDrawClipper_GetClipList(
-    LPDIRECTDRAWCLIPPER iface, LPRECT lpRect, LPRGNDATA lpClipList,
-    LPDWORD lpdwSize)
-{
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-
-    TRACE("(%p,%p,%p,%p)\n", This, lpRect, lpClipList, lpdwSize);
-
-    if (This->hWnd)
-    {
-        HDC hDC = GetDCEx(This->hWnd, NULL, DCX_WINDOW);
-        if (hDC)
-        {
-            HRGN hRgn = CreateRectRgn(0,0,0,0);
-            if (GetRandomRgn(hDC, hRgn, SYSRGN))
-            {
-                if (lpRect)
-                {
-                    HRGN hRgnClip = CreateRectRgn(lpRect->left, lpRect->top,
-                        lpRect->right, lpRect->bottom);
-                    CombineRgn(hRgn, hRgn, hRgnClip, RGN_AND);
-                    DeleteObject(hRgnClip);
-                }
-                *lpdwSize = GetRegionData(hRgn, *lpdwSize, lpClipList);
-            }
-            DeleteObject(hRgn);
-            ReleaseDC(This->hWnd, hDC);
-        }
-        return DD_OK;
-    }
-    else
-    {
-        static int warned = 0;
-        if (warned++ < 10)
-            FIXME("(%p,%p,%p,%p),stub!\n",This,lpRect,lpClipList,lpdwSize);
-        if (lpdwSize) *lpdwSize=0;
-        return DDERR_NOCLIPLIST;
-    }
-}
-
-/***********************************************************************
-*           IDirectDrawClipper::SetClipList
-*
-* Sets or deletes (if lprgn is NULL) the clip list
-*
-* PARAMS
-*  lprgn   Pointer to a LRGNDATA structure or NULL
-*  dwFlags not used, must be 0
-* RETURNS
-*  Either DD_OK or DDERR_*
-*/
-HRESULT WINAPI Main_DirectDrawClipper_SetClipList(
-    LPDIRECTDRAWCLIPPER iface,LPRGNDATA lprgn,DWORD dwFlag
-) {
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-    static int warned = 0;
-    if (warned++ < 10 || lprgn == NULL)
-        FIXME("(%p,%p,%ld),stub!\n",This,lprgn,dwFlag);
-    return DD_OK;
-}
-
-HRESULT WINAPI Main_DirectDrawClipper_QueryInterface(
-    LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj
-) {
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-
-    if (IsEqualGUID(&IID_IUnknown, riid)
-	|| IsEqualGUID(&IID_IDirectDrawClipper, riid))
-    {
-	*ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper);
-	InterlockedIncrement(&This->ref);
-	return S_OK;
-    }
-    else
-    {
-	return E_NOINTERFACE;
-    }
-}
-
-ULONG WINAPI Main_DirectDrawClipper_AddRef( LPDIRECTDRAWCLIPPER iface )
-{
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-    ULONG ref = InterlockedIncrement(&This->ref);
-
-    TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1);
-
-    return ref;
-}
-
-HRESULT WINAPI Main_DirectDrawClipper_GetHWnd(
-    LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr
-) {
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-    TRACE("(%p)->(%p)\n", This, hWndPtr);
-
-    *hWndPtr = This->hWnd;
-
-    return DD_OK;
-}
-
-HRESULT WINAPI Main_DirectDrawClipper_Initialize(
-     LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags
-) {
-    IDirectDrawImpl* pOwner;
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-    TRACE("(%p)->(%p,0x%08lx)\n", This, lpDD, dwFlags);
-
-    if (This->ddraw_owner != NULL) return DDERR_ALREADYINITIALIZED;
-
-    pOwner = ICOM_OBJECT(IDirectDrawImpl, IDirectDraw, lpDD);
-    This->ddraw_owner = pOwner;
-    Main_DirectDraw_AddClipper(pOwner, This);
-
-    return DD_OK;
-}
-
-HRESULT WINAPI Main_DirectDrawClipper_IsClipListChanged(
-    LPDIRECTDRAWCLIPPER iface, BOOL* lpbChanged
-) {
-    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
-    FIXME("(%p)->(%p),stub!\n",This,lpbChanged);
-
-    /* XXX What is safest? */
-    *lpbChanged = FALSE;
-
-    return DD_OK;
-}
-
-static const IDirectDrawClipperVtbl DDRAW_Clipper_VTable =
-{
-    Main_DirectDrawClipper_QueryInterface,
-    Main_DirectDrawClipper_AddRef,
-    Main_DirectDrawClipper_Release,
-    Main_DirectDrawClipper_GetClipList,
-    Main_DirectDrawClipper_GetHWnd,
-    Main_DirectDrawClipper_Initialize,
-    Main_DirectDrawClipper_IsClipListChanged,
-    Main_DirectDrawClipper_SetClipList,
-    Main_DirectDrawClipper_SetHwnd
-};
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/ddraw/clipper.c	2005-06-02 23:12:17.000000000 +0100
@@ -0,0 +1,285 @@
+/*		DirectDrawClipper implementation
+ *
+ * Copyright 2000 Marcus Meissner
+ * Copyright 2000 TransGaming Technologies Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define CONST_VTABLE
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "ddraw.h"
+#include "winerror.h"
+
+#include "ddraw_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
+
+/******************************************************************************
+ *			DirectDrawCreateClipper (DDRAW.@)
+ */
+
+static const IDirectDrawClipperVtbl DDRAW_Clipper_VTable;
+
+HRESULT WINAPI DirectDrawCreateClipper(
+    DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, LPUNKNOWN pUnkOuter
+) {
+    IDirectDrawClipperImpl* This;
+    TRACE("(%08lx,%p,%p)\n", dwFlags, lplpDDClipper, pUnkOuter);
+
+    if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION;
+
+    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+		     sizeof(IDirectDrawClipperImpl));
+    if (This == NULL) return E_OUTOFMEMORY;
+
+    ICOM_INIT_INTERFACE(This, IDirectDrawClipper, DDRAW_Clipper_VTable);
+    This->ref = 1;
+    This->hWnd = 0;
+    This->ddraw_owner = NULL;
+
+    *lplpDDClipper = ICOM_INTERFACE(This, IDirectDrawClipper);
+    return DD_OK;
+}
+
+/* This is the classfactory implementation. */
+HRESULT DDRAW_CreateDirectDrawClipper(IUnknown* pUnkOuter, REFIID riid,
+				      LPVOID* ppObj)
+{
+    HRESULT hr;
+    LPDIRECTDRAWCLIPPER pClip;
+
+    hr = DirectDrawCreateClipper(0, &pClip, pUnkOuter);
+    if (FAILED(hr)) return hr;
+
+    hr = IDirectDrawClipper_QueryInterface(pClip, riid, ppObj);
+    IDirectDrawClipper_Release(pClip);
+    return hr;
+}
+
+/******************************************************************************
+ *			IDirectDrawClipper
+ */
+HRESULT WINAPI Main_DirectDrawClipper_SetHwnd(
+    LPDIRECTDRAWCLIPPER iface, DWORD dwFlags, HWND hWnd
+) {
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+
+    TRACE("(%p)->(0x%08lx,0x%08lx)\n", This, dwFlags, (DWORD)hWnd);
+    if( dwFlags ) {
+	FIXME("dwFlags = 0x%08lx, not supported.\n",dwFlags);
+	return DDERR_INVALIDPARAMS;
+    }
+
+    This->hWnd = hWnd;
+    return DD_OK;
+}
+
+static void Main_DirectDrawClipper_Destroy(IDirectDrawClipperImpl* This)
+{
+    if (This->ddraw_owner != NULL)
+	Main_DirectDraw_RemoveClipper(This->ddraw_owner, This);
+
+    HeapFree(GetProcessHeap(), 0 ,This);
+}
+
+void Main_DirectDrawClipper_ForceDestroy(IDirectDrawClipperImpl* This)
+{
+    WARN("deleting clipper %p with refcnt %lu\n", This, This->ref);
+    Main_DirectDrawClipper_Destroy(This);
+}
+
+ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) {
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1);
+
+    if (ref == 0)
+    {
+	Main_DirectDrawClipper_Destroy(This);
+	return 0;
+    }
+    else return ref;
+}
+
+/***********************************************************************
+*           IDirectDrawClipper::GetClipList
+*
+* Retrieve a copy of the clip list
+*
+* PARAMS
+*  lpRect  Rectangle to be used to clip the clip list or NULL for the
+*          entire clip list
+*  lpClipList structure for the resulting copy of the clip list.
+           If NULL, fills lpdwSize up to the number of bytes necessary to hold
+           the entire clip.
+*  lpdwSize Size of resulting clip list; size of the buffer at lpClipList
+           or, if lpClipList is NULL, receives the required size of the buffer
+           in bytes
+* RETURNS
+*  Either DD_OK or DDERR_*
+*/
+HRESULT WINAPI Main_DirectDrawClipper_GetClipList(
+    LPDIRECTDRAWCLIPPER iface, LPRECT lpRect, LPRGNDATA lpClipList,
+    LPDWORD lpdwSize)
+{
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+
+    TRACE("(%p,%p,%p,%p)\n", This, lpRect, lpClipList, lpdwSize);
+
+    if (This->hWnd)
+    {
+        HDC hDC = GetDCEx(This->hWnd, NULL, DCX_WINDOW);
+        if (hDC)
+        {
+            HRGN hRgn = CreateRectRgn(0,0,0,0);
+            if (GetRandomRgn(hDC, hRgn, SYSRGN))
+            {
+                if (lpRect)
+                {
+                    HRGN hRgnClip = CreateRectRgn(lpRect->left, lpRect->top,
+                        lpRect->right, lpRect->bottom);
+                    CombineRgn(hRgn, hRgn, hRgnClip, RGN_AND);
+                    DeleteObject(hRgnClip);
+                }
+                *lpdwSize = GetRegionData(hRgn, *lpdwSize, lpClipList);
+            }
+            DeleteObject(hRgn);
+            ReleaseDC(This->hWnd, hDC);
+        }
+        return DD_OK;
+    }
+    else
+    {
+        static int warned = 0;
+        if (warned++ < 10)
+            FIXME("(%p,%p,%p,%p),stub!\n",This,lpRect,lpClipList,lpdwSize);
+        if (lpdwSize) *lpdwSize=0;
+        return DDERR_NOCLIPLIST;
+    }
+}
+
+/***********************************************************************
+*           IDirectDrawClipper::SetClipList
+*
+* Sets or deletes (if lprgn is NULL) the clip list
+*
+* PARAMS
+*  lprgn   Pointer to a LRGNDATA structure or NULL
+*  dwFlags not used, must be 0
+* RETURNS
+*  Either DD_OK or DDERR_*
+*/
+HRESULT WINAPI Main_DirectDrawClipper_SetClipList(
+    LPDIRECTDRAWCLIPPER iface,LPRGNDATA lprgn,DWORD dwFlag
+) {
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+    static int warned = 0;
+    if (warned++ < 10 || lprgn == NULL)
+        FIXME("(%p,%p,%ld),stub!\n",This,lprgn,dwFlag);
+    return DD_OK;
+}
+
+HRESULT WINAPI Main_DirectDrawClipper_QueryInterface(
+    LPDIRECTDRAWCLIPPER iface, REFIID riid, LPVOID* ppvObj
+) {
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+
+    if (IsEqualGUID(&IID_IUnknown, riid)
+	|| IsEqualGUID(&IID_IDirectDrawClipper, riid))
+    {
+	*ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper);
+	InterlockedIncrement(&This->ref);
+	return S_OK;
+    }
+    else
+    {
+	return E_NOINTERFACE;
+    }
+}
+
+ULONG WINAPI Main_DirectDrawClipper_AddRef( LPDIRECTDRAWCLIPPER iface )
+{
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1);
+
+    return ref;
+}
+
+HRESULT WINAPI Main_DirectDrawClipper_GetHWnd(
+    LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr
+) {
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+    TRACE("(%p)->(%p)\n", This, hWndPtr);
+
+    *hWndPtr = This->hWnd;
+
+    return DD_OK;
+}
+
+HRESULT WINAPI Main_DirectDrawClipper_Initialize(
+     LPDIRECTDRAWCLIPPER iface, LPDIRECTDRAW lpDD, DWORD dwFlags
+) {
+    IDirectDrawImpl* pOwner;
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+    TRACE("(%p)->(%p,0x%08lx)\n", This, lpDD, dwFlags);
+
+    if (This->ddraw_owner != NULL) return DDERR_ALREADYINITIALIZED;
+
+    pOwner = ICOM_OBJECT(IDirectDrawImpl, IDirectDraw, lpDD);
+    This->ddraw_owner = pOwner;
+    Main_DirectDraw_AddClipper(pOwner, This);
+
+    return DD_OK;
+}
+
+HRESULT WINAPI Main_DirectDrawClipper_IsClipListChanged(
+    LPDIRECTDRAWCLIPPER iface, BOOL* lpbChanged
+) {
+    IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface;
+    FIXME("(%p)->(%p),stub!\n",This,lpbChanged);
+
+    /* XXX What is safest? */
+    *lpbChanged = FALSE;
+
+    return DD_OK;
+}
+
+static const IDirectDrawClipperVtbl DDRAW_Clipper_VTable =
+{
+    Main_DirectDrawClipper_QueryInterface,
+    Main_DirectDrawClipper_AddRef,
+    Main_DirectDrawClipper_Release,
+    Main_DirectDrawClipper_GetClipList,
+    Main_DirectDrawClipper_GetHWnd,
+    Main_DirectDrawClipper_Initialize,
+    Main_DirectDrawClipper_IsClipListChanged,
+    Main_DirectDrawClipper_SetClipList,
+    Main_DirectDrawClipper_SetHwnd
+};
--- dlls/ddraw/dpalette/main.c	2005-06-02 21:37:43.000000000 +0100
+++ /dev/null	1970-01-01 01:00:00.000000000 +0100
@@ -1,283 +0,0 @@
-/*		DirectDraw - IDirectPalette base interface
- *
- * Copyright 1997-2000 Marcus Meissner
- * Copyright 2000-2001 TransGaming Technologies Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "config.h"
-#include "winerror.h"
-#include "wine/debug.h"
-
-#include <assert.h>
-#include <string.h>
-
-#define CONST_VTABLE
-
-#include "ddraw_private.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
-
-#define SIZE_BITS (DDPCAPS_1BIT | DDPCAPS_2BIT | DDPCAPS_4BIT | DDPCAPS_8BIT)
-
-/* For unsigned x. 0 is not a power of 2. */
-#define IS_POW_2(x) (((x) & ((x) - 1)) == 0)
-
-static const IDirectDrawPaletteVtbl DDRAW_Main_Palette_VTable;
-
-/******************************************************************************
- *			IDirectDrawPalette
- */
-HRESULT Main_DirectDrawPalette_Construct(IDirectDrawPaletteImpl* This,
-					 IDirectDrawImpl* pDD, DWORD dwFlags)
-{
-    if (!IS_POW_2(dwFlags & SIZE_BITS)) return DDERR_INVALIDPARAMS;
-
-    if (dwFlags & DDPCAPS_8BITENTRIES)
-	WARN("creating palette with 8 bit entries\n");
-
-    This->palNumEntries = Main_DirectDrawPalette_Size(dwFlags);
-    This->ref = 1;
-
-    This->local.lpGbl = &This->global;
-    This->local.lpDD_lcl = &pDD->local;
-    This->global.lpDD_lcl = &pDD->local;
-    This->global.dwProcessId = GetCurrentProcessId();
-    This->global.dwFlags = dwFlags;
-
-    This->final_release = Main_DirectDrawPalette_final_release;
-    ICOM_INIT_INTERFACE(This, IDirectDrawPalette, DDRAW_Main_Palette_VTable);
-
-    /* we could defer hpal creation until we need it,
-     * but does anyone have a case where it would be useful? */
-    This->hpal = CreatePalette((const LOGPALETTE*)&(This->palVersion));
-
-    Main_DirectDraw_AddPalette(pDD, This);
-
-    return DD_OK;
-}
-
-HRESULT
-Main_DirectDrawPalette_Create(IDirectDrawImpl* pDD, DWORD dwFlags,
-			      LPDIRECTDRAWPALETTE* ppPalette,
-			      LPUNKNOWN pUnkOuter)
-{
-    IDirectDrawPaletteImpl* This;
-    HRESULT hr;
-
-    if (pUnkOuter != NULL)
-	return CLASS_E_NOAGGREGATION; /* unchecked */
-
-    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
-    if (This == NULL) return E_OUTOFMEMORY;
-
-    hr = Main_DirectDrawPalette_Construct(This, pDD, dwFlags);
-    if (FAILED(hr))
-	HeapFree(GetProcessHeap(), 0, This);
-    else
-	*ppPalette = ICOM_INTERFACE(This, IDirectDrawPalette);
-
-    return hr;
-}
-
-DWORD Main_DirectDrawPalette_Size(DWORD dwFlags)
-{
-    switch (dwFlags & SIZE_BITS)
-    {
-    case DDPCAPS_1BIT: return 2;
-    case DDPCAPS_2BIT: return 4;
-    case DDPCAPS_4BIT: return 16;
-    case DDPCAPS_8BIT: return 256;
-    default: assert(0); return 256;
-    }
-}
-
-HRESULT WINAPI
-Main_DirectDrawPalette_GetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
-				  DWORD dwStart, DWORD dwCount,
-				  LPPALETTEENTRY palent)
-{
-    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-
-    TRACE("(%p)->GetEntries(%08lx,%ld,%ld,%p)\n",This,dwFlags,dwStart,dwCount,
-	  palent);
-
-    if (dwFlags != 0) return DDERR_INVALIDPARAMS; /* unchecked */
-    if (dwStart + dwCount > Main_DirectDrawPalette_Size(This->global.dwFlags))
-	return DDERR_INVALIDPARAMS;
-
-    if (This->global.dwFlags & DDPCAPS_8BITENTRIES)
-    {
-	unsigned int i;
-	LPBYTE entry = (LPBYTE)palent;
-
-	for (i=dwStart; i < dwCount+dwStart; i++)
-	    *entry++ = This->palents[i].peRed;
-    }
-    else
-	memcpy(palent, This->palents+dwStart, dwCount * sizeof(PALETTEENTRY));
-
-    return DD_OK;
-}
-
-HRESULT WINAPI
-Main_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
-				  DWORD dwStart, DWORD dwCount,
-				  LPPALETTEENTRY palent)
-{
-    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-
-    TRACE("(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",This,dwFlags,dwStart,dwCount,
-	  palent);
-
-    if (This->global.dwFlags & DDPCAPS_8BITENTRIES)
-    {
-	unsigned int i;
-	const BYTE* entry = (const BYTE*)palent;
-
-	for (i=dwStart; i < dwCount+dwStart; i++)
-	    This->palents[i].peRed = *entry++;
-    }
-    else {
-	memcpy(This->palents+dwStart, palent, dwCount * sizeof(PALETTEENTRY));
-
-	if (This->hpal)
-	    SetPaletteEntries(This->hpal, dwStart, dwCount, This->palents+dwStart);
-
-	if (This->global.dwFlags & DDPCAPS_PRIMARYSURFACE) {
-	    /* update physical palette */
-	    LPDIRECTDRAWSURFACE7 psurf = NULL;
-	    IDirectDraw7_GetGDISurface(ICOM_INTERFACE(This->ddraw_owner,IDirectDraw7), &psurf);
-	    if (psurf) {
-		IDirectDrawSurfaceImpl *surf = ICOM_OBJECT(IDirectDrawSurfaceImpl,
-							   IDirectDrawSurface7, psurf);
-		surf->update_palette(surf, This, dwStart, dwCount, palent);
-		IDirectDrawSurface7_Release(psurf);
-	    }
-	    else ERR("can't find GDI surface!!\n");
-	}
-    }
-
-#if 0
-    /* Now, if we are in 'depth conversion mode', update the screen palette */
-    /* FIXME: we need to update the image or we won't get palette fading. */
-    if (This->ddraw->d->palette_convert != NULL)
-	This->ddraw->d->palette_convert(palent,This->screen_palents,start,count);
-#endif
-
-    return DD_OK;
-}
-
-void Main_DirectDrawPalette_final_release(IDirectDrawPaletteImpl* This)
-{
-    Main_DirectDraw_RemovePalette(This->ddraw_owner, This);
-
-    if (This->hpal) DeleteObject(This->hpal);
-}
-
-static void Main_DirectDrawPalette_Destroy(IDirectDrawPaletteImpl* This)
-{
-    This->final_release(This);
-
-    if (This->private != This+1)
-	HeapFree(GetProcessHeap(), 0, This->private);
-
-    HeapFree(GetProcessHeap(),0,This);
-}
-
-void Main_DirectDrawPalette_ForceDestroy(IDirectDrawPaletteImpl* This)
-{
-    WARN("deleting palette %p with refcnt %lu\n", This, This->ref);
-    Main_DirectDrawPalette_Destroy(This);
-}
-
-ULONG WINAPI
-Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface)
-{
-    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-    ULONG ref = InterlockedDecrement(&This->ref);
-
-    TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1);
-
-    if (!ref)
-    {
-	Main_DirectDrawPalette_Destroy(This);
-	return 0;
-    }
-
-    return ref;
-}
-
-ULONG WINAPI Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface) {
-    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-    ULONG ref = InterlockedIncrement(&This->ref);
-
-    TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1);
-
-    return ref;
-}
-
-HRESULT WINAPI
-Main_DirectDrawPalette_Initialize(LPDIRECTDRAWPALETTE iface,
-				  LPDIRECTDRAW ddraw, DWORD dwFlags,
-				  LPPALETTEENTRY palent)
-{
-    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-    TRACE("(%p)->(%p,%ld,%p)\n", This, ddraw, dwFlags, palent);
-    return DDERR_ALREADYINITIALIZED;
-}
-
-HRESULT WINAPI
-Main_DirectDrawPalette_GetCaps(LPDIRECTDRAWPALETTE iface, LPDWORD lpdwCaps)
-{
-   IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-   TRACE("(%p)->(%p)\n",This,lpdwCaps);
-
-   *lpdwCaps = This->global.dwFlags;
-
-   return DD_OK;
-}
-
-HRESULT WINAPI
-Main_DirectDrawPalette_QueryInterface(LPDIRECTDRAWPALETTE iface,
-				      REFIID refiid, LPVOID *obj)
-{
-    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-    TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
-
-    if (IsEqualGUID(refiid, &IID_IUnknown)
-	|| IsEqualGUID(refiid, &IID_IDirectDrawPalette))
-    {
-	*obj = iface;
-	IDirectDrawPalette_AddRef(iface);
-	return S_OK;
-    }
-    else
-    {
-	return E_NOINTERFACE;
-    }
-}
-
-static const IDirectDrawPaletteVtbl DDRAW_Main_Palette_VTable =
-{
-    Main_DirectDrawPalette_QueryInterface,
-    Main_DirectDrawPalette_AddRef,
-    Main_DirectDrawPalette_Release,
-    Main_DirectDrawPalette_GetCaps,
-    Main_DirectDrawPalette_GetEntries,
-    Main_DirectDrawPalette_Initialize,
-    Main_DirectDrawPalette_SetEntries
-};
--- dlls/ddraw/dpalette/hal.c	2005-06-02 21:37:43.000000000 +0100
+++ /dev/null	1970-01-01 01:00:00.000000000 +0100
@@ -1,136 +0,0 @@
-/*	DirectDrawPalette HAL driver
- *
- * Copyright 2001 TransGaming Technologies Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "config.h"
-#include "winerror.h"
-#include "wine/debug.h"
-
-#include <assert.h>
-#include <string.h>
-
-#define CONST_VTABLE
-
-#include "ddraw_private.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
-
-static const IDirectDrawPaletteVtbl DDRAW_HAL_Palette_VTable;
-
-/******************************************************************************
- *			IDirectDrawPalette
- */
-HRESULT HAL_DirectDrawPalette_Construct(IDirectDrawPaletteImpl* This,
-					IDirectDrawImpl* pDD, DWORD dwFlags)
-{
-    LPDDRAWI_DIRECTDRAW_GBL dd_gbl = pDD->local.lpGbl;
-    DDHAL_CREATEPALETTEDATA data;
-    HRESULT hr;
-
-    hr = Main_DirectDrawPalette_Construct(This, pDD, dwFlags);
-    if (FAILED(hr)) return hr;
-
-    This->final_release = HAL_DirectDrawPalette_final_release;
-    ICOM_INIT_INTERFACE(This, IDirectDrawPalette, DDRAW_HAL_Palette_VTable);
-
-    /* initialize HAL palette */
-    data.lpDD = dd_gbl;
-    data.lpDDPalette = &This->global;
-    data.lpColorTable = NULL;
-    data.ddRVal = 0;
-    data.CreatePalette = dd_gbl->lpDDCBtmp->HALDD.CreatePalette;
-    if (data.CreatePalette)
-	data.CreatePalette(&data);
-
-    return DD_OK;
-}
-
-HRESULT
-HAL_DirectDrawPalette_Create(IDirectDrawImpl* pDD, DWORD dwFlags,
-			     LPDIRECTDRAWPALETTE* ppPalette,
-			     LPUNKNOWN pUnkOuter)
-{
-    IDirectDrawPaletteImpl* This;
-    HRESULT hr;
-
-    if (pUnkOuter != NULL)
-	return CLASS_E_NOAGGREGATION; /* unchecked */
-
-    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
-    if (This == NULL) return E_OUTOFMEMORY;
-
-    hr = HAL_DirectDrawPalette_Construct(This, pDD, dwFlags);
-    if (FAILED(hr))
-	HeapFree(GetProcessHeap(), 0, This);
-    else
-	*ppPalette = ICOM_INTERFACE(This, IDirectDrawPalette);
-
-    return hr;
-}
-
-HRESULT WINAPI
-HAL_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
-				 DWORD dwStart, DWORD dwCount,
-				 LPPALETTEENTRY palent)
-{
-    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
-    LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->local.lpDD_lcl->lpGbl;
-    DDHAL_SETENTRIESDATA data;
-
-    TRACE("(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",This,dwFlags,dwStart,dwCount,
-	  palent);
-
-    data.lpDD = dd_gbl;
-    data.lpDDPalette = &This->global;
-    data.dwBase = dwStart;
-    data.dwNumEntries = dwCount;
-    data.lpEntries = palent;
-    data.ddRVal = 0;
-    data.SetEntries = dd_gbl->lpDDCBtmp->HALDDPalette.SetEntries;
-    if (data.SetEntries)
-	data.SetEntries(&data);
-
-    return Main_DirectDrawPalette_SetEntries(iface, dwFlags, dwStart, dwCount, palent);
-}
-
-void HAL_DirectDrawPalette_final_release(IDirectDrawPaletteImpl* This)
-{
-    LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->local.lpDD_lcl->lpGbl;
-    DDHAL_DESTROYPALETTEDATA data;
-
-    /* destroy HAL palette */
-    data.lpDD = dd_gbl;
-    data.lpDDPalette = &This->global;
-    data.ddRVal = 0;
-    data.DestroyPalette = dd_gbl->lpDDCBtmp->HALDDPalette.DestroyPalette;
-    if (data.DestroyPalette)
-	data.DestroyPalette(&data);
-
-    Main_DirectDrawPalette_final_release(This);
-}
-
-static const IDirectDrawPaletteVtbl DDRAW_HAL_Palette_VTable =
-{
-    Main_DirectDrawPalette_QueryInterface,
-    Main_DirectDrawPalette_AddRef,
-    Main_DirectDrawPalette_Release,
-    Main_DirectDrawPalette_GetCaps,
-    Main_DirectDrawPalette_GetEntries,
-    Main_DirectDrawPalette_Initialize,
-    HAL_DirectDrawPalette_SetEntries
-};
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/ddraw/palette_main.c	2005-06-02 23:19:21.000000000 +0100
@@ -0,0 +1,283 @@
+/*		DirectDraw - IDirectPalette base interface
+ *
+ * Copyright 1997-2000 Marcus Meissner
+ * Copyright 2000-2001 TransGaming Technologies Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+#include "winerror.h"
+#include "wine/debug.h"
+
+#include <assert.h>
+#include <string.h>
+
+#define CONST_VTABLE
+
+#include "ddraw_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
+
+#define SIZE_BITS (DDPCAPS_1BIT | DDPCAPS_2BIT | DDPCAPS_4BIT | DDPCAPS_8BIT)
+
+/* For unsigned x. 0 is not a power of 2. */
+#define IS_POW_2(x) (((x) & ((x) - 1)) == 0)
+
+static const IDirectDrawPaletteVtbl DDRAW_Main_Palette_VTable;
+
+/******************************************************************************
+ *			IDirectDrawPalette
+ */
+HRESULT Main_DirectDrawPalette_Construct(IDirectDrawPaletteImpl* This,
+					 IDirectDrawImpl* pDD, DWORD dwFlags)
+{
+    if (!IS_POW_2(dwFlags & SIZE_BITS)) return DDERR_INVALIDPARAMS;
+
+    if (dwFlags & DDPCAPS_8BITENTRIES)
+	WARN("creating palette with 8 bit entries\n");
+
+    This->palNumEntries = Main_DirectDrawPalette_Size(dwFlags);
+    This->ref = 1;
+
+    This->local.lpGbl = &This->global;
+    This->local.lpDD_lcl = &pDD->local;
+    This->global.lpDD_lcl = &pDD->local;
+    This->global.dwProcessId = GetCurrentProcessId();
+    This->global.dwFlags = dwFlags;
+
+    This->final_release = Main_DirectDrawPalette_final_release;
+    ICOM_INIT_INTERFACE(This, IDirectDrawPalette, DDRAW_Main_Palette_VTable);
+
+    /* we could defer hpal creation until we need it,
+     * but does anyone have a case where it would be useful? */
+    This->hpal = CreatePalette((const LOGPALETTE*)&(This->palVersion));
+
+    Main_DirectDraw_AddPalette(pDD, This);
+
+    return DD_OK;
+}
+
+HRESULT
+Main_DirectDrawPalette_Create(IDirectDrawImpl* pDD, DWORD dwFlags,
+			      LPDIRECTDRAWPALETTE* ppPalette,
+			      LPUNKNOWN pUnkOuter)
+{
+    IDirectDrawPaletteImpl* This;
+    HRESULT hr;
+
+    if (pUnkOuter != NULL)
+	return CLASS_E_NOAGGREGATION; /* unchecked */
+
+    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
+    if (This == NULL) return E_OUTOFMEMORY;
+
+    hr = Main_DirectDrawPalette_Construct(This, pDD, dwFlags);
+    if (FAILED(hr))
+	HeapFree(GetProcessHeap(), 0, This);
+    else
+	*ppPalette = ICOM_INTERFACE(This, IDirectDrawPalette);
+
+    return hr;
+}
+
+DWORD Main_DirectDrawPalette_Size(DWORD dwFlags)
+{
+    switch (dwFlags & SIZE_BITS)
+    {
+    case DDPCAPS_1BIT: return 2;
+    case DDPCAPS_2BIT: return 4;
+    case DDPCAPS_4BIT: return 16;
+    case DDPCAPS_8BIT: return 256;
+    default: assert(0); return 256;
+    }
+}
+
+HRESULT WINAPI
+Main_DirectDrawPalette_GetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
+				  DWORD dwStart, DWORD dwCount,
+				  LPPALETTEENTRY palent)
+{
+    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+
+    TRACE("(%p)->GetEntries(%08lx,%ld,%ld,%p)\n",This,dwFlags,dwStart,dwCount,
+	  palent);
+
+    if (dwFlags != 0) return DDERR_INVALIDPARAMS; /* unchecked */
+    if (dwStart + dwCount > Main_DirectDrawPalette_Size(This->global.dwFlags))
+	return DDERR_INVALIDPARAMS;
+
+    if (This->global.dwFlags & DDPCAPS_8BITENTRIES)
+    {
+	unsigned int i;
+	LPBYTE entry = (LPBYTE)palent;
+
+	for (i=dwStart; i < dwCount+dwStart; i++)
+	    *entry++ = This->palents[i].peRed;
+    }
+    else
+	memcpy(palent, This->palents+dwStart, dwCount * sizeof(PALETTEENTRY));
+
+    return DD_OK;
+}
+
+HRESULT WINAPI
+Main_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
+				  DWORD dwStart, DWORD dwCount,
+				  LPPALETTEENTRY palent)
+{
+    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+
+    TRACE("(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",This,dwFlags,dwStart,dwCount,
+	  palent);
+
+    if (This->global.dwFlags & DDPCAPS_8BITENTRIES)
+    {
+	unsigned int i;
+	const BYTE* entry = (const BYTE*)palent;
+
+	for (i=dwStart; i < dwCount+dwStart; i++)
+	    This->palents[i].peRed = *entry++;
+    }
+    else {
+	memcpy(This->palents+dwStart, palent, dwCount * sizeof(PALETTEENTRY));
+
+	if (This->hpal)
+	    SetPaletteEntries(This->hpal, dwStart, dwCount, This->palents+dwStart);
+
+	if (This->global.dwFlags & DDPCAPS_PRIMARYSURFACE) {
+	    /* update physical palette */
+	    LPDIRECTDRAWSURFACE7 psurf = NULL;
+	    IDirectDraw7_GetGDISurface(ICOM_INTERFACE(This->ddraw_owner,IDirectDraw7), &psurf);
+	    if (psurf) {
+		IDirectDrawSurfaceImpl *surf = ICOM_OBJECT(IDirectDrawSurfaceImpl,
+							   IDirectDrawSurface7, psurf);
+		surf->update_palette(surf, This, dwStart, dwCount, palent);
+		IDirectDrawSurface7_Release(psurf);
+	    }
+	    else ERR("can't find GDI surface!!\n");
+	}
+    }
+
+#if 0
+    /* Now, if we are in 'depth conversion mode', update the screen palette */
+    /* FIXME: we need to update the image or we won't get palette fading. */
+    if (This->ddraw->d->palette_convert != NULL)
+	This->ddraw->d->palette_convert(palent,This->screen_palents,start,count);
+#endif
+
+    return DD_OK;
+}
+
+void Main_DirectDrawPalette_final_release(IDirectDrawPaletteImpl* This)
+{
+    Main_DirectDraw_RemovePalette(This->ddraw_owner, This);
+
+    if (This->hpal) DeleteObject(This->hpal);
+}
+
+static void Main_DirectDrawPalette_Destroy(IDirectDrawPaletteImpl* This)
+{
+    This->final_release(This);
+
+    if (This->private != This+1)
+	HeapFree(GetProcessHeap(), 0, This->private);
+
+    HeapFree(GetProcessHeap(),0,This);
+}
+
+void Main_DirectDrawPalette_ForceDestroy(IDirectDrawPaletteImpl* This)
+{
+    WARN("deleting palette %p with refcnt %lu\n", This, This->ref);
+    Main_DirectDrawPalette_Destroy(This);
+}
+
+ULONG WINAPI
+Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface)
+{
+    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1);
+
+    if (!ref)
+    {
+	Main_DirectDrawPalette_Destroy(This);
+	return 0;
+    }
+
+    return ref;
+}
+
+ULONG WINAPI Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface) {
+    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1);
+
+    return ref;
+}
+
+HRESULT WINAPI
+Main_DirectDrawPalette_Initialize(LPDIRECTDRAWPALETTE iface,
+				  LPDIRECTDRAW ddraw, DWORD dwFlags,
+				  LPPALETTEENTRY palent)
+{
+    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+    TRACE("(%p)->(%p,%ld,%p)\n", This, ddraw, dwFlags, palent);
+    return DDERR_ALREADYINITIALIZED;
+}
+
+HRESULT WINAPI
+Main_DirectDrawPalette_GetCaps(LPDIRECTDRAWPALETTE iface, LPDWORD lpdwCaps)
+{
+   IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+   TRACE("(%p)->(%p)\n",This,lpdwCaps);
+
+   *lpdwCaps = This->global.dwFlags;
+
+   return DD_OK;
+}
+
+HRESULT WINAPI
+Main_DirectDrawPalette_QueryInterface(LPDIRECTDRAWPALETTE iface,
+				      REFIID refiid, LPVOID *obj)
+{
+    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+    TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(refiid),obj);
+
+    if (IsEqualGUID(refiid, &IID_IUnknown)
+	|| IsEqualGUID(refiid, &IID_IDirectDrawPalette))
+    {
+	*obj = iface;
+	IDirectDrawPalette_AddRef(iface);
+	return S_OK;
+    }
+    else
+    {
+	return E_NOINTERFACE;
+    }
+}
+
+static const IDirectDrawPaletteVtbl DDRAW_Main_Palette_VTable =
+{
+    Main_DirectDrawPalette_QueryInterface,
+    Main_DirectDrawPalette_AddRef,
+    Main_DirectDrawPalette_Release,
+    Main_DirectDrawPalette_GetCaps,
+    Main_DirectDrawPalette_GetEntries,
+    Main_DirectDrawPalette_Initialize,
+    Main_DirectDrawPalette_SetEntries
+};
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ dlls/ddraw/palette_hal.c	2005-06-02 23:19:14.000000000 +0100
@@ -0,0 +1,136 @@
+/*	DirectDrawPalette HAL driver
+ *
+ * Copyright 2001 TransGaming Technologies Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+#include "winerror.h"
+#include "wine/debug.h"
+
+#include <assert.h>
+#include <string.h>
+
+#define CONST_VTABLE
+
+#include "ddraw_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
+
+static const IDirectDrawPaletteVtbl DDRAW_HAL_Palette_VTable;
+
+/******************************************************************************
+ *			IDirectDrawPalette
+ */
+HRESULT HAL_DirectDrawPalette_Construct(IDirectDrawPaletteImpl* This,
+					IDirectDrawImpl* pDD, DWORD dwFlags)
+{
+    LPDDRAWI_DIRECTDRAW_GBL dd_gbl = pDD->local.lpGbl;
+    DDHAL_CREATEPALETTEDATA data;
+    HRESULT hr;
+
+    hr = Main_DirectDrawPalette_Construct(This, pDD, dwFlags);
+    if (FAILED(hr)) return hr;
+
+    This->final_release = HAL_DirectDrawPalette_final_release;
+    ICOM_INIT_INTERFACE(This, IDirectDrawPalette, DDRAW_HAL_Palette_VTable);
+
+    /* initialize HAL palette */
+    data.lpDD = dd_gbl;
+    data.lpDDPalette = &This->global;
+    data.lpColorTable = NULL;
+    data.ddRVal = 0;
+    data.CreatePalette = dd_gbl->lpDDCBtmp->HALDD.CreatePalette;
+    if (data.CreatePalette)
+	data.CreatePalette(&data);
+
+    return DD_OK;
+}
+
+HRESULT
+HAL_DirectDrawPalette_Create(IDirectDrawImpl* pDD, DWORD dwFlags,
+			     LPDIRECTDRAWPALETTE* ppPalette,
+			     LPUNKNOWN pUnkOuter)
+{
+    IDirectDrawPaletteImpl* This;
+    HRESULT hr;
+
+    if (pUnkOuter != NULL)
+	return CLASS_E_NOAGGREGATION; /* unchecked */
+
+    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
+    if (This == NULL) return E_OUTOFMEMORY;
+
+    hr = HAL_DirectDrawPalette_Construct(This, pDD, dwFlags);
+    if (FAILED(hr))
+	HeapFree(GetProcessHeap(), 0, This);
+    else
+	*ppPalette = ICOM_INTERFACE(This, IDirectDrawPalette);
+
+    return hr;
+}
+
+HRESULT WINAPI
+HAL_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
+				 DWORD dwStart, DWORD dwCount,
+				 LPPALETTEENTRY palent)
+{
+    IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface;
+    LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->local.lpDD_lcl->lpGbl;
+    DDHAL_SETENTRIESDATA data;
+
+    TRACE("(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",This,dwFlags,dwStart,dwCount,
+	  palent);
+
+    data.lpDD = dd_gbl;
+    data.lpDDPalette = &This->global;
+    data.dwBase = dwStart;
+    data.dwNumEntries = dwCount;
+    data.lpEntries = palent;
+    data.ddRVal = 0;
+    data.SetEntries = dd_gbl->lpDDCBtmp->HALDDPalette.SetEntries;
+    if (data.SetEntries)
+	data.SetEntries(&data);
+
+    return Main_DirectDrawPalette_SetEntries(iface, dwFlags, dwStart, dwCount, palent);
+}
+
+void HAL_DirectDrawPalette_final_release(IDirectDrawPaletteImpl* This)
+{
+    LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->local.lpDD_lcl->lpGbl;
+    DDHAL_DESTROYPALETTEDATA data;
+
+    /* destroy HAL palette */
+    data.lpDD = dd_gbl;
+    data.lpDDPalette = &This->global;
+    data.ddRVal = 0;
+    data.DestroyPalette = dd_gbl->lpDDCBtmp->HALDDPalette.DestroyPalette;
+    if (data.DestroyPalette)
+	data.DestroyPalette(&data);
+
+    Main_DirectDrawPalette_final_release(This);
+}
+
+static const IDirectDrawPaletteVtbl DDRAW_HAL_Palette_VTable =
+{
+    Main_DirectDrawPalette_QueryInterface,
+    Main_DirectDrawPalette_AddRef,
+    Main_DirectDrawPalette_Release,
+    Main_DirectDrawPalette_GetCaps,
+    Main_DirectDrawPalette_GetEntries,
+    Main_DirectDrawPalette_Initialize,
+    HAL_DirectDrawPalette_SetEntries
+};


More information about the wine-patches mailing list