Added the DFCS_{HOT,TRANSPARENT} definitions.
[wine/gsoc_dplay.git] / dlls / ddraw / dsurface / fakezbuffer.c
blob54781bd809b920bb8bde88b365dd7ce51959da72
1 /* DirectDraw/Direct3D Z-Buffer stand in
3 * Copyright 2000 TransGaming Technologies Inc.
5 * This class provides a DirectDrawSurface implementation that represents
6 * a Z-Buffer surface. However it does not store an image and does not
7 * support Lock/Unlock or GetDC. It is merely a placeholder required by the
8 * Direct3D architecture.
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "config.h"
27 #include <stdlib.h>
28 #include <assert.h>
30 #include "ddraw.h"
31 #include "d3d.h"
33 #include "wine/debug.h"
35 #include "ddcomimpl.h"
36 #include "ddraw_private.h"
37 #include "dsurface/main.h"
38 #include "dsurface/fakezbuffer.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
42 static ICOM_VTABLE(IDirectDrawSurface7) FakeZBuffer_IDirectDrawSurface7_VTable;
44 HRESULT FakeZBuffer_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl *This,
45 IDirectDrawImpl *pDD,
46 const DDSURFACEDESC2 *pDDSD)
48 HRESULT hr;
50 assert(pDDSD->ddsCaps.dwCaps & DDSCAPS_ZBUFFER);
52 hr = Main_DirectDrawSurface_Construct(This, pDD, pDDSD);
53 if (FAILED(hr)) return hr;
55 ICOM_INIT_INTERFACE(This, IDirectDrawSurface7,
56 FakeZBuffer_IDirectDrawSurface7_VTable);
58 This->final_release = FakeZBuffer_DirectDrawSurface_final_release;
59 This->duplicate_surface = FakeZBuffer_DirectDrawSurface_duplicate_surface;
61 return DD_OK;
64 /* Not an API */
65 HRESULT FakeZBuffer_DirectDrawSurface_Create(IDirectDrawImpl* pDD,
66 const DDSURFACEDESC2* pDDSD,
67 LPDIRECTDRAWSURFACE7* ppSurf,
68 IUnknown* pUnkOuter)
70 IDirectDrawSurfaceImpl* This;
71 HRESULT hr;
72 assert(pUnkOuter == NULL);
74 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
75 sizeof(*This)
76 + sizeof(FakeZBuffer_DirectDrawSurfaceImpl));
77 if (This == NULL) return E_OUTOFMEMORY;
79 This->private = (FakeZBuffer_DirectDrawSurfaceImpl*)(This+1);
81 hr = FakeZBuffer_DirectDrawSurface_Construct(This, pDD, pDDSD);
82 if (FAILED(hr))
83 HeapFree(GetProcessHeap(), 0, This);
84 else
85 *ppSurf = ICOM_INTERFACE(This, IDirectDrawSurface7);
87 return hr;
90 void
91 FakeZBuffer_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This)
93 return Main_DirectDrawSurface_final_release(This);
96 HRESULT
97 FakeZBuffer_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
98 LPDIRECTDRAWSURFACE7* ppDup)
100 return FakeZBuffer_DirectDrawSurface_Create(This->ddraw_owner,
101 &This->surface_desc, ppDup,
102 NULL);
105 /* put your breakpoint/abort call here */
106 static HRESULT cant_do_that(const char *s)
108 FIXME("attempt to %s fake z-buffer\n", s);
109 return DDERR_UNSUPPORTED;
112 HRESULT WINAPI
113 FakeZBuffer_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
114 LPDIRECTDRAWSURFACE7 src, LPRECT rsrc,
115 DWORD dwFlags, LPDDBLTFX lpbltfx)
117 return cant_do_that("blt to a");
120 HRESULT WINAPI
121 FakeZBuffer_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
122 DWORD dsty, LPDIRECTDRAWSURFACE7 src,
123 LPRECT rsrc, DWORD trans)
125 return cant_do_that("bltfast to a");
128 HRESULT WINAPI
129 FakeZBuffer_DirectDrawSurface_GetDC(LPDIRECTDRAWSURFACE7 iface, HDC *phDC)
131 return cant_do_that("get a DC for a");
134 HRESULT WINAPI
135 FakeZBuffer_DirectDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE7 iface, HDC hDC)
137 return cant_do_that("release a DC for a");
140 HRESULT WINAPI
141 FakeZBuffer_DirectDrawSurface_Restore(LPDIRECTDRAWSURFACE7 iface)
143 return DD_OK;
146 HRESULT WINAPI
147 FakeZBuffer_DirectDrawSurface_SetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface,
148 LPDDSURFACEDESC2 pDDSD,
149 DWORD dwFlags)
151 /* XXX */
152 abort();
153 return E_FAIL;
157 static ICOM_VTABLE(IDirectDrawSurface7) FakeZBuffer_IDirectDrawSurface7_VTable=
159 Main_DirectDrawSurface_QueryInterface,
160 Main_DirectDrawSurface_AddRef,
161 Main_DirectDrawSurface_Release,
162 Main_DirectDrawSurface_AddAttachedSurface,
163 Main_DirectDrawSurface_AddOverlayDirtyRect,
164 FakeZBuffer_DirectDrawSurface_Blt,
165 Main_DirectDrawSurface_BltBatch,
166 FakeZBuffer_DirectDrawSurface_BltFast,
167 Main_DirectDrawSurface_DeleteAttachedSurface,
168 Main_DirectDrawSurface_EnumAttachedSurfaces,
169 Main_DirectDrawSurface_EnumOverlayZOrders,
170 Main_DirectDrawSurface_Flip,
171 Main_DirectDrawSurface_GetAttachedSurface,
172 Main_DirectDrawSurface_GetBltStatus,
173 Main_DirectDrawSurface_GetCaps,
174 Main_DirectDrawSurface_GetClipper,
175 Main_DirectDrawSurface_GetColorKey,
176 FakeZBuffer_DirectDrawSurface_GetDC,
177 Main_DirectDrawSurface_GetFlipStatus,
178 Main_DirectDrawSurface_GetOverlayPosition,
179 Main_DirectDrawSurface_GetPalette,
180 Main_DirectDrawSurface_GetPixelFormat,
181 Main_DirectDrawSurface_GetSurfaceDesc,
182 Main_DirectDrawSurface_Initialize,
183 Main_DirectDrawSurface_IsLost,
184 Main_DirectDrawSurface_Lock,
185 FakeZBuffer_DirectDrawSurface_ReleaseDC,
186 FakeZBuffer_DirectDrawSurface_Restore,
187 Main_DirectDrawSurface_SetClipper,
188 Main_DirectDrawSurface_SetColorKey,
189 Main_DirectDrawSurface_SetOverlayPosition,
190 Main_DirectDrawSurface_SetPalette,
191 Main_DirectDrawSurface_Unlock,
192 Main_DirectDrawSurface_UpdateOverlay,
193 Main_DirectDrawSurface_UpdateOverlayDisplay,
194 Main_DirectDrawSurface_UpdateOverlayZOrder,
195 Main_DirectDrawSurface_GetDDInterface,
196 Main_DirectDrawSurface_PageLock,
197 Main_DirectDrawSurface_PageUnlock,
198 FakeZBuffer_DirectDrawSurface_SetSurfaceDesc,
199 Main_DirectDrawSurface_SetPrivateData,
200 Main_DirectDrawSurface_GetPrivateData,
201 Main_DirectDrawSurface_FreePrivateData,
202 Main_DirectDrawSurface_GetUniquenessValue,
203 Main_DirectDrawSurface_ChangeUniquenessValue,
204 Main_DirectDrawSurface_SetPriority,
205 Main_DirectDrawSurface_GetPriority,
206 Main_DirectDrawSurface_SetLOD,
207 Main_DirectDrawSurface_GetLOD