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.
19 #include "debugtools.h"
21 #include "ddcomimpl.h"
22 #include "ddraw_private.h"
23 #include "dsurface/main.h"
24 #include "dsurface/fakezbuffer.h"
26 DEFAULT_DEBUG_CHANNEL(ddraw);
28 static ICOM_VTABLE(IDirectDrawSurface7) FakeZBuffer_IDirectDrawSurface7_VTable;
30 HRESULT FakeZBuffer_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl *This,
32 const DDSURFACEDESC2 *pDDSD)
36 assert(pDDSD->ddsCaps.dwCaps & DDSCAPS_ZBUFFER);
38 hr = Main_DirectDrawSurface_Construct(This, pDD, pDDSD);
39 if (FAILED(hr)) return hr;
41 ICOM_INIT_INTERFACE(This, IDirectDrawSurface7,
42 FakeZBuffer_IDirectDrawSurface7_VTable);
44 This->final_release = FakeZBuffer_DirectDrawSurface_final_release;
45 This->duplicate_surface = FakeZBuffer_DirectDrawSurface_duplicate_surface;
51 HRESULT FakeZBuffer_DirectDrawSurface_Create(IDirectDrawImpl* pDD,
52 const DDSURFACEDESC2* pDDSD,
53 LPDIRECTDRAWSURFACE7* ppSurf,
56 IDirectDrawSurfaceImpl* This;
58 assert(pUnkOuter == NULL);
60 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
62 + sizeof(FakeZBuffer_DirectDrawSurfaceImpl));
63 if (This == NULL) return E_OUTOFMEMORY;
65 This->private = (FakeZBuffer_DirectDrawSurfaceImpl*)(This+1);
67 hr = FakeZBuffer_DirectDrawSurface_Construct(This, pDD, pDDSD);
69 HeapFree(GetProcessHeap(), 0, This);
71 *ppSurf = ICOM_INTERFACE(This, IDirectDrawSurface7);
77 FakeZBuffer_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This)
79 return Main_DirectDrawSurface_final_release(This);
83 FakeZBuffer_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
84 LPDIRECTDRAWSURFACE7* ppDup)
86 return FakeZBuffer_DirectDrawSurface_Create(This->ddraw_owner,
87 &This->surface_desc, ppDup,
91 /* put your breakpoint/abort call here */
92 static HRESULT cant_do_that(const char *s)
94 FIXME("attempt to %s fake z-buffer\n", s);
95 return DDERR_UNSUPPORTED;
99 FakeZBuffer_DirectDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
100 LPDIRECTDRAWSURFACE7 src, LPRECT rsrc,
101 DWORD dwFlags, LPDDBLTFX lpbltfx)
103 return cant_do_that("blt to a");
107 FakeZBuffer_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
108 DWORD dsty, LPDIRECTDRAWSURFACE7 src,
109 LPRECT rsrc, DWORD trans)
111 return cant_do_that("bltfast to a");
115 FakeZBuffer_DirectDrawSurface_GetDC(LPDIRECTDRAWSURFACE7 iface, HDC *phDC)
117 return cant_do_that("get a DC for a");
121 FakeZBuffer_DirectDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE7 iface, HDC hDC)
123 return cant_do_that("release a DC for a");
127 FakeZBuffer_DirectDrawSurface_Restore(LPDIRECTDRAWSURFACE7 iface)
133 FakeZBuffer_DirectDrawSurface_SetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface,
134 LPDDSURFACEDESC2 pDDSD,
143 static ICOM_VTABLE(IDirectDrawSurface7) FakeZBuffer_IDirectDrawSurface7_VTable=
145 Main_DirectDrawSurface_QueryInterface,
146 Main_DirectDrawSurface_AddRef,
147 Main_DirectDrawSurface_Release,
148 Main_DirectDrawSurface_AddAttachedSurface,
149 Main_DirectDrawSurface_AddOverlayDirtyRect,
150 FakeZBuffer_DirectDrawSurface_Blt,
151 Main_DirectDrawSurface_BltBatch,
152 FakeZBuffer_DirectDrawSurface_BltFast,
153 Main_DirectDrawSurface_DeleteAttachedSurface,
154 Main_DirectDrawSurface_EnumAttachedSurfaces,
155 Main_DirectDrawSurface_EnumOverlayZOrders,
156 Main_DirectDrawSurface_Flip,
157 Main_DirectDrawSurface_GetAttachedSurface,
158 Main_DirectDrawSurface_GetBltStatus,
159 Main_DirectDrawSurface_GetCaps,
160 Main_DirectDrawSurface_GetClipper,
161 Main_DirectDrawSurface_GetColorKey,
162 FakeZBuffer_DirectDrawSurface_GetDC,
163 Main_DirectDrawSurface_GetFlipStatus,
164 Main_DirectDrawSurface_GetOverlayPosition,
165 Main_DirectDrawSurface_GetPalette,
166 Main_DirectDrawSurface_GetPixelFormat,
167 Main_DirectDrawSurface_GetSurfaceDesc,
168 Main_DirectDrawSurface_Initialize,
169 Main_DirectDrawSurface_IsLost,
170 Main_DirectDrawSurface_Lock,
171 FakeZBuffer_DirectDrawSurface_ReleaseDC,
172 FakeZBuffer_DirectDrawSurface_Restore,
173 Main_DirectDrawSurface_SetClipper,
174 Main_DirectDrawSurface_SetColorKey,
175 Main_DirectDrawSurface_SetOverlayPosition,
176 Main_DirectDrawSurface_SetPalette,
177 Main_DirectDrawSurface_Unlock,
178 Main_DirectDrawSurface_UpdateOverlay,
179 Main_DirectDrawSurface_UpdateOverlayDisplay,
180 Main_DirectDrawSurface_UpdateOverlayZOrder,
181 Main_DirectDrawSurface_GetDDInterface,
182 Main_DirectDrawSurface_PageLock,
183 Main_DirectDrawSurface_PageUnlock,
184 FakeZBuffer_DirectDrawSurface_SetSurfaceDesc,
185 Main_DirectDrawSurface_SetPrivateData,
186 Main_DirectDrawSurface_GetPrivateData,
187 Main_DirectDrawSurface_FreePrivateData,
188 Main_DirectDrawSurface_GetUniquenessValue,
189 Main_DirectDrawSurface_ChangeUniquenessValue,
190 Main_DirectDrawSurface_SetPriority,
191 Main_DirectDrawSurface_GetPriority,
192 Main_DirectDrawSurface_SetLOD,
193 Main_DirectDrawSurface_GetLOD