1 /* DirectDraw IDirectDraw interface (generic)
3 * Copyright 1997-2000 Marcus Meissner
4 * Copyright 1998-2000 Lionel Ulmer (most of Direct3D stuff)
5 * Copyright 2000-2001 TransGaming Technologies Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * This file contains all the interface functions that are shared between
24 * all interfaces. Or better, it is a "common stub" library for the
25 * IDirectDraw* objects
29 #include "wine/port.h"
37 #include "wine/debug.h"
39 #include "ddraw_private.h"
40 #include "mesa_private.h" /* To have the D3D creation function */
41 #include "ddraw/main.h"
42 #include "dclipper/main.h"
43 #include "dpalette/main.h"
44 #include "dsurface/main.h"
45 #include "dsurface/dib.h"
46 #include "dsurface/fakezbuffer.h"
48 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
50 extern ICOM_VTABLE(IDirectDraw) DDRAW_IDirectDraw_VTable;
51 extern ICOM_VTABLE(IDirectDraw2) DDRAW_IDirectDraw2_VTable;
52 extern ICOM_VTABLE(IDirectDraw4) DDRAW_IDirectDraw4_VTable;
54 static void DDRAW_UnsubclassWindow(IDirectDrawImpl* This);
56 static void Main_DirectDraw_DeleteSurfaces(IDirectDrawImpl* This);
57 static void Main_DirectDraw_DeleteClippers(IDirectDrawImpl* This);
58 static void Main_DirectDraw_DeletePalettes(IDirectDrawImpl* This);
59 static void LosePrimarySurface(IDirectDrawImpl* This);
61 static INT32 allocate_memory(IDirectDrawImpl *This, DWORD mem) ;
62 static void free_memory(IDirectDrawImpl *This, DWORD mem) ;
65 static const char ddProp[] = "WINE_DDRAW_Property";
67 /* Not called from the vtable. */
68 HRESULT Main_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
70 /* NOTE: The creator must use HEAP_ZERO_MEMORY or equivalent. */
74 if (ex) This->local.dwLocalFlags |= DDRAWILCL_DIRECTDRAW7;
75 This->local.dwProcessId = GetCurrentProcessId();
77 This->final_release = Main_DirectDraw_final_release;
79 This->create_palette = Main_DirectDrawPalette_Create;
81 This->create_offscreen = Main_create_offscreen;
82 This->create_texture = Main_create_texture;
83 This->create_zbuffer = Main_create_zbuffer;
84 /* There are no generic versions of create_{primary,backbuffer}. */
86 ICOM_INIT_INTERFACE(This, IDirectDraw, DDRAW_IDirectDraw_VTable);
87 ICOM_INIT_INTERFACE(This, IDirectDraw2, DDRAW_IDirectDraw2_VTable);
88 ICOM_INIT_INTERFACE(This, IDirectDraw4, DDRAW_IDirectDraw4_VTable);
89 /* There is no generic implementation of IDD7 */
91 /* This is for the moment here... */
92 This->free_memory = free_memory;
93 This->allocate_memory = allocate_memory;
94 This->total_vidmem = 16 * 1024 * 1024;
95 This->available_vidmem = This->total_vidmem;
100 void Main_DirectDraw_final_release(IDirectDrawImpl* This)
102 if (IsWindow(This->window))
104 if (GetPropA(This->window, ddProp))
105 DDRAW_UnsubclassWindow(This);
107 FIXME("this shouldn't happen, right?\n");
110 Main_DirectDraw_DeleteSurfaces(This);
111 Main_DirectDraw_DeleteClippers(This);
112 Main_DirectDraw_DeletePalettes(This);
113 if (This->local.lpGbl && This->local.lpGbl->lpExclusiveOwner == &This->local)
115 This->local.lpGbl->lpExclusiveOwner = NULL;
116 if (This->set_exclusive_mode)
117 This->set_exclusive_mode(This, FALSE);
121 /* There is no Main_DirectDraw_Create. */
123 ULONG WINAPI Main_DirectDraw_AddRef(LPDIRECTDRAW7 iface) {
124 ICOM_THIS(IDirectDrawImpl,iface);
125 TRACE("(%p)->() incrementing from %lu.\n", This, This->ref );
130 ULONG WINAPI Main_DirectDraw_Release(LPDIRECTDRAW7 iface) {
132 ICOM_THIS(IDirectDrawImpl,iface);
133 TRACE("(%p)->() decrementing from %lu.\n", This, This->ref );
139 if (This->final_release != NULL)
140 This->final_release(This);
142 /* We free the private. This is an artifact of the fact that I don't
143 * have the destructors set up correctly. */
144 if (This->private != (This+1))
145 HeapFree(GetProcessHeap(), 0, This->private);
147 HeapFree(GetProcessHeap(), 0, This);
153 HRESULT WINAPI Main_DirectDraw_QueryInterface(
154 LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj
156 ICOM_THIS(IDirectDrawImpl,iface);
157 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(refiid), obj);
159 /* According to COM docs, if the QueryInterface fails, obj should be set to NULL */
162 if ( IsEqualGUID( &IID_IUnknown, refiid )
163 || IsEqualGUID( &IID_IDirectDraw7, refiid ) )
165 *obj = ICOM_INTERFACE(This, IDirectDraw7);
167 else if ( IsEqualGUID( &IID_IDirectDraw, refiid ) )
169 *obj = ICOM_INTERFACE(This, IDirectDraw);
171 else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) )
173 *obj = ICOM_INTERFACE(This, IDirectDraw2);
175 else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
177 *obj = ICOM_INTERFACE(This, IDirectDraw4);
180 else if ( IsEqualGUID( &IID_IDirect3D , refiid ) ||
181 IsEqualGUID( &IID_IDirect3D2 , refiid ) ||
182 IsEqualGUID( &IID_IDirect3D3 , refiid ) ||
183 IsEqualGUID( &IID_IDirect3D7 , refiid ) )
185 IDirect3DImpl *d3d_impl;
188 ret_value = direct3d_create(&d3d_impl, This);
189 if (FAILED(ret_value)) return ret_value;
191 if ( IsEqualGUID( &IID_IDirect3D , refiid ) ) {
192 *obj = ICOM_INTERFACE(d3d_impl, IDirect3D);
193 TRACE(" returning Direct3D interface at %p.\n", *obj);
194 } else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) ) {
195 *obj = ICOM_INTERFACE(d3d_impl, IDirect3D2);
196 TRACE(" returning Direct3D2 interface at %p.\n", *obj);
197 } else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) ) {
198 *obj = ICOM_INTERFACE(d3d_impl, IDirect3D3);
199 TRACE(" returning Direct3D3 interface at %p.\n", *obj);
201 *obj = ICOM_INTERFACE(d3d_impl, IDirect3D7);
202 TRACE(" returning Direct3D7 interface at %p.\n", *obj);
205 /* And store the D3D object */
206 This->d3d = d3d_impl;
211 FIXME("(%p)->(%s,%p): no interface\n",This,debugstr_guid(refiid),obj);
212 return E_NOINTERFACE;
215 IDirectDraw7_AddRef(iface);
219 /* MSDN: "not currently implemented". */
220 HRESULT WINAPI Main_DirectDraw_Compact(LPDIRECTDRAW7 iface)
222 TRACE("(%p)\n", iface);
227 HRESULT WINAPI Main_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface,
229 LPDIRECTDRAWCLIPPER *ppClipper,
232 ICOM_THIS(IDirectDrawImpl, iface);
235 TRACE("(%p)->(0x%lx, %p, %p)\n", iface, dwFlags, ppClipper, pUnkOuter);
237 hr = DirectDrawCreateClipper(dwFlags, ppClipper, pUnkOuter);
238 if (FAILED(hr)) return hr;
240 /* dwFlags is passed twice, apparently an API wart. */
241 hr = IDirectDrawClipper_Initialize(*ppClipper,
242 ICOM_INTERFACE(This, IDirectDraw),
246 IDirectDrawClipper_Release(*ppClipper);
254 Main_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
255 LPPALETTEENTRY palent,
256 LPDIRECTDRAWPALETTE* ppPalette,
259 ICOM_THIS(IDirectDrawImpl,iface);
260 LPDIRECTDRAWPALETTE pPalette;
263 TRACE("(%p)->(%08lx,%p,%p,%p)\n",This,dwFlags,palent,ppPalette,pUnknown);
265 if (ppPalette == NULL) return E_POINTER; /* unchecked */
266 if (pUnknown != NULL) return CLASS_E_NOAGGREGATION; /* unchecked */
268 hr = This->create_palette(This, dwFlags, &pPalette, pUnknown);
269 if (FAILED(hr)) return hr;
271 hr = IDirectDrawPalette_SetEntries(pPalette, 0, 0,
272 Main_DirectDrawPalette_Size(dwFlags),
276 IDirectDrawPalette_Release(pPalette);
281 *ppPalette = pPalette;
287 Main_create_offscreen(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD,
288 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter)
290 assert(pOuter == NULL);
292 return DIB_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
296 Main_create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD,
297 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter,
300 assert(pOuter == NULL);
302 return DIB_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
306 Main_create_zbuffer(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD,
307 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter)
309 assert(pOuter == NULL);
311 return FakeZBuffer_DirectDrawSurface_Create(This, pDDSD, ppSurf, pOuter);
314 /* Does the texture surface described in pDDSD have any smaller mipmaps? */
315 static BOOL more_mipmaps(const DDSURFACEDESC2 *pDDSD)
317 return ((pDDSD->dwFlags & DDSD_MIPMAPCOUNT) && pDDSD->u2.dwMipMapCount > 1
318 && (pDDSD->dwWidth > 1 || pDDSD->dwHeight > 1));
321 /* Create a texture surface along with any of its mipmaps. */
323 create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2 *pDDSD,
324 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pUnkOuter)
327 DWORD mipmap_level = 0;
330 assert(pUnkOuter == NULL);
332 /* is this check right? (pixelformat can be copied from primary) */
333 if ((pDDSD->dwFlags&(DDSD_HEIGHT|DDSD_WIDTH)) != (DDSD_HEIGHT|DDSD_WIDTH))
334 return DDERR_INVALIDPARAMS;
336 ddsd.dwSize = sizeof(ddsd);
337 DD_STRUCT_COPY_BYSIZE((&ddsd),pDDSD);
339 if (!(ddsd.dwFlags & DDSD_PIXELFORMAT))
341 ddsd.u4.ddpfPixelFormat = This->pixelformat;
344 /* We do not support for now compressed texture formats... */
345 if (ddsd.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
347 return DDERR_INVALIDPIXELFORMAT;
350 if (!(ddsd.dwFlags & DDSD_PITCH))
352 ddsd.u1.lPitch = DDRAW_width_bpp_to_pitch(ddsd.dwWidth,
356 ddsd.dwFlags |= DDSD_PITCH | DDSD_PIXELFORMAT;
358 hr = This->create_texture(This, &ddsd, ppSurf, pUnkOuter, mipmap_level);
359 if (FAILED(hr)) return hr;
361 if (This->d3d) This->d3d->create_texture(This->d3d, ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf), TRUE,
362 ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf), mipmap_level);
364 /* Create attached mipmaps if required. */
365 if (more_mipmaps(&ddsd))
367 LPDIRECTDRAWSURFACE7 mipmap;
368 LPDIRECTDRAWSURFACE7 prev_mipmap;
369 DDSURFACEDESC2 mipmap_surface_desc;
371 prev_mipmap = *ppSurf;
372 IDirectDrawSurface7_AddRef(prev_mipmap);
373 mipmap_surface_desc = ddsd;
374 mipmap_surface_desc.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL;
376 while (more_mipmaps(&mipmap_surface_desc))
380 mipmap_surface_desc.u2.dwMipMapCount--;
382 if (mipmap_surface_desc.dwWidth > 1)
383 mipmap_surface_desc.dwWidth /= 2;
385 if (mipmap_surface_desc.dwHeight > 1)
386 mipmap_surface_desc.dwHeight /= 2;
388 mipmap_surface_desc.u1.lPitch
389 = DDRAW_width_bpp_to_pitch(mipmap_surface_desc.dwWidth,
392 hr = This->create_texture(This, &mipmap_surface_desc, &mipmap,
393 pUnkOuter, mipmap_level);
396 IDirectDrawSurface7_Release(prev_mipmap);
397 IDirectDrawSurface7_Release(*ppSurf);
400 if (This->d3d) This->d3d->create_texture(This->d3d, ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, mipmap), TRUE,
401 ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, *ppSurf), mipmap_level);
403 IDirectDrawSurface7_AddAttachedSurface(prev_mipmap, mipmap);
404 IDirectDrawSurface7_Release(prev_mipmap);
405 prev_mipmap = mipmap;
408 IDirectDrawSurface7_Release(prev_mipmap);
414 /* Creates a primary surface and any indicated backbuffers. */
416 create_primary(IDirectDrawImpl* This, LPDDSURFACEDESC2 pDDSD,
417 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pUnkOuter)
422 assert(pUnkOuter == NULL);
424 if (This->primary_surface != NULL)
425 return DDERR_PRIMARYSURFACEALREADYEXISTS;
427 /* as documented (what about pitch?) */
428 if (pDDSD->dwFlags & (DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT))
429 return DDERR_INVALIDPARAMS;
431 ddsd.dwSize = sizeof(ddsd);
432 DD_STRUCT_COPY_BYSIZE((&ddsd),pDDSD);
433 ddsd.dwFlags |= DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | DDSD_PIXELFORMAT;
434 ddsd.dwHeight = This->height;
435 ddsd.dwWidth = This->width;
436 ddsd.u1.lPitch = This->pitch;
437 ddsd.u4.ddpfPixelFormat = This->pixelformat;
438 ddsd.ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY
439 | DDSCAPS_VISIBLE | DDSCAPS_FRONTBUFFER;
441 if ((ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) && ddsd.dwBackBufferCount > 0)
442 ddsd.ddsCaps.dwCaps |= DDSCAPS_FLIP;
444 hr = This->create_primary(This, &ddsd, ppSurf, pUnkOuter);
445 if (FAILED(hr)) return hr;
447 if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT)
449 IDirectDrawSurfaceImpl* primary;
450 LPDIRECTDRAWSURFACE7 pPrev;
453 ddsd.dwFlags &= ~DDSD_BACKBUFFERCOUNT;
454 ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_VISIBLE | DDSCAPS_PRIMARYSURFACE
455 | DDSCAPS_BACKBUFFER | DDSCAPS_FRONTBUFFER);
457 primary = ICOM_OBJECT(IDirectDrawSurfaceImpl,IDirectDrawSurface7,
460 IDirectDrawSurface7_AddRef(pPrev);
462 for (i=0; i < ddsd.dwBackBufferCount; i++)
464 LPDIRECTDRAWSURFACE7 pBack;
467 ddsd.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
469 ddsd.ddsCaps.dwCaps &= ~DDSCAPS_BACKBUFFER;
471 hr = This->create_backbuffer(This, &ddsd, &pBack, pUnkOuter,
476 IDirectDraw7_Release(pPrev);
477 IDirectDraw7_Release(*ppSurf);
481 IDirectDrawSurface7_AddAttachedSurface(pPrev, pBack);
482 IDirectDrawSurface7_Release(pPrev);
486 IDirectDrawSurface7_Release(pPrev);
489 This->primary_surface = (IDirectDrawSurfaceImpl *)*ppSurf;
495 create_offscreen(IDirectDrawImpl* This, LPDDSURFACEDESC2 pDDSD,
496 LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pUnkOuter)
501 /* is this check right? (pixelformat can be copied from primary) */
502 if ((pDDSD->dwFlags&(DDSD_HEIGHT|DDSD_WIDTH)) != (DDSD_HEIGHT|DDSD_WIDTH))
503 return DDERR_INVALIDPARAMS;
505 ddsd.dwSize = sizeof(ddsd);
506 DD_STRUCT_COPY_BYSIZE((&ddsd),pDDSD);
508 if (!(ddsd.dwFlags & DDSD_PIXELFORMAT))
510 ddsd.u4.ddpfPixelFormat = This->pixelformat;
513 if (!(ddsd.dwFlags & DDSD_PITCH))
515 ddsd.u1.lPitch = DDRAW_width_bpp_to_pitch(ddsd.dwWidth,
519 ddsd.dwFlags |= DDSD_PITCH | DDSD_PIXELFORMAT;
521 hr = This->create_offscreen(This, &ddsd, ppSurf, pUnkOuter);
522 if (FAILED(hr)) return hr;
528 Main_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
529 LPDIRECTDRAWSURFACE7 *ppSurf,
533 ICOM_THIS(IDirectDrawImpl, iface);
535 TRACE("(%p)->(%p,%p,%p)\n",This,pDDSD,ppSurf,pUnkOuter);
536 if (TRACE_ON(ddraw)) {
537 DPRINTF("Requesting surface desc :\n");
538 DDRAW_dump_surface_desc(pDDSD);
541 if (pUnkOuter != NULL) {
542 FIXME("outer != NULL?\n");
543 return CLASS_E_NOAGGREGATION; /* unchecked */
546 if (!(pDDSD->dwFlags & DDSD_CAPS)) {
547 /* DVIDEO.DLL does forget the DDSD_CAPS flag ... *sigh* */
548 pDDSD->dwFlags |= DDSD_CAPS;
551 if (ppSurf == NULL) {
552 FIXME("You want to get back a surface? Don't give NULL ptrs!\n");
553 return E_POINTER; /* unchecked */
556 if (pDDSD->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
558 /* create primary surface & backbuffers */
559 hr = create_primary(This, pDDSD, ppSurf, pUnkOuter);
561 else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_BACKBUFFER)
563 /* create backbuffer surface */
564 hr = This->create_backbuffer(This, pDDSD, ppSurf, pUnkOuter, NULL);
566 else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
569 hr = create_texture(This, pDDSD, ppSurf, pUnkOuter);
571 else if ((pDDSD->ddsCaps.dwCaps & DDSCAPS_OFFSCREENPLAIN) ||
572 (pDDSD->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)) /* No difference in Wine right now */
574 /* create offscreenplain surface */
575 hr = create_offscreen(This, pDDSD, ppSurf, pUnkOuter);
577 else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
579 /* create z-buffer */
580 hr = This->create_zbuffer(This, pDDSD, ppSurf, pUnkOuter);
584 /* Otherwise, assume offscreenplain surface */
585 FIXME("App didn't request a valid surface type - assuming offscreenplain\n");
586 hr = create_offscreen(This, pDDSD, ppSurf, pUnkOuter);
590 FIXME("failed surface creation with code 0x%08lx\n",hr);
598 Main_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7 src,
599 LPDIRECTDRAWSURFACE7* dst)
601 ICOM_THIS(IDirectDrawImpl,iface);
603 IDirectDrawSurfaceImpl *pSrc = ICOM_OBJECT(IDirectDrawSurfaceImpl,
604 IDirectDrawSurface7, src);
606 TRACE("(%p)->(%p,%p)\n",This,src,dst);
608 return pSrc->duplicate_surface(pSrc, dst);
611 /* EnumDisplayModes */
613 BOOL Main_DirectDraw_DDPIXELFORMAT_Match(const DDPIXELFORMAT *requested,
614 const DDPIXELFORMAT *provided)
616 /* Some flags must be present in both or neither for a match. */
617 static const DWORD must_match = DDPF_PALETTEINDEXED1 | DDPF_PALETTEINDEXED2
618 | DDPF_PALETTEINDEXED4 | DDPF_PALETTEINDEXED8 | DDPF_FOURCC
619 | DDPF_ZBUFFER | DDPF_STENCILBUFFER;
621 if ((requested->dwFlags & provided->dwFlags) != requested->dwFlags)
624 if ((requested->dwFlags & must_match) != (provided->dwFlags & must_match))
627 if (requested->dwFlags & DDPF_FOURCC)
628 if (requested->dwFourCC != provided->dwFourCC)
631 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_ZBUFFER|DDPF_ALPHA
632 |DDPF_LUMINANCE|DDPF_BUMPDUDV))
633 if (requested->u1.dwRGBBitCount != provided->u1.dwRGBBitCount)
636 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_STENCILBUFFER
637 |DDPF_LUMINANCE|DDPF_BUMPDUDV))
638 if (requested->u2.dwRBitMask != provided->u2.dwRBitMask)
641 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_ZBUFFER|DDPF_BUMPDUDV))
642 if (requested->u3.dwGBitMask != provided->u3.dwGBitMask)
645 /* I could be wrong about the bumpmapping. MSDN docs are vague. */
646 if (requested->dwFlags & (DDPF_RGB|DDPF_YUV|DDPF_STENCILBUFFER
648 if (requested->u4.dwBBitMask != provided->u4.dwBBitMask)
651 if (requested->dwFlags & (DDPF_ALPHAPIXELS|DDPF_ZPIXELS))
652 if (requested->u5.dwRGBAlphaBitMask != provided->u5.dwRGBAlphaBitMask)
658 BOOL Main_DirectDraw_DDSD_Match(const DDSURFACEDESC2* requested,
659 const DDSURFACEDESC2* provided)
668 #define CMP(FLAG, FIELD) \
669 { DDSD_##FLAG, offsetof(DDSURFACEDESC2, FIELD), \
670 sizeof(((DDSURFACEDESC2 *)(NULL))->FIELD) }
672 static const struct compare_info compare[] = {
673 CMP(ALPHABITDEPTH, dwAlphaBitDepth),
674 CMP(BACKBUFFERCOUNT, dwBackBufferCount),
676 CMP(CKDESTBLT, ddckCKDestBlt),
677 CMP(CKDESTOVERLAY, u3.ddckCKDestOverlay),
678 CMP(CKSRCBLT, ddckCKSrcBlt),
679 CMP(CKSRCOVERLAY, ddckCKSrcOverlay),
680 CMP(HEIGHT, dwHeight),
681 CMP(LINEARSIZE, u1.dwLinearSize),
682 CMP(LPSURFACE, lpSurface),
683 CMP(MIPMAPCOUNT, u2.dwMipMapCount),
684 CMP(PITCH, u1.lPitch),
685 /* PIXELFORMAT: manual */
686 CMP(REFRESHRATE, u2.dwRefreshRate),
687 CMP(TEXTURESTAGE, dwTextureStage),
689 /* ZBUFFERBITDEPTH: "obsolete" */
696 if ((requested->dwFlags & provided->dwFlags) != requested->dwFlags)
699 for (i=0; i < sizeof(compare)/sizeof(compare[0]); i++)
701 if (requested->dwFlags & compare[i].flag
702 && memcmp((const char *)provided + compare[i].offset,
703 (const char *)requested + compare[i].offset,
704 compare[i].size) != 0)
708 if (requested->dwFlags & DDSD_PIXELFORMAT)
710 if (!Main_DirectDraw_DDPIXELFORMAT_Match(&requested->u4.ddpfPixelFormat,
711 &provided->u4.ddpfPixelFormat))
718 #define DDENUMSURFACES_SEARCHTYPE (DDENUMSURFACES_CANBECREATED|DDENUMSURFACES_DOESEXIST)
719 #define DDENUMSURFACES_MATCHTYPE (DDENUMSURFACES_ALL|DDENUMSURFACES_MATCH|DDENUMSURFACES_NOMATCH)
721 /* This should be extended so that it can be used by
722 * IDirectDrawSurface7::EnumAttachedSurfaces. */
724 Main_DirectDraw_EnumExistingSurfaces(IDirectDrawImpl *This, DWORD dwFlags,
725 LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
726 LPDDENUMSURFACESCALLBACK7 callback)
728 IDirectDrawSurfaceImpl *surf;
731 /* A NULL lpDDSD2 is permitted if we are enumerating all surfaces anyway */
732 if (lpDDSD2 == NULL && !(dwFlags & DDENUMSURFACES_ALL))
733 return DDERR_INVALIDPARAMS;
735 all = dwFlags & DDENUMSURFACES_ALL;
736 nomatch = dwFlags & DDENUMSURFACES_NOMATCH;
738 for (surf = This->surfaces; surf != NULL; surf = surf->next_ddraw)
741 || (nomatch != Main_DirectDraw_DDSD_Match(lpDDSD2,
742 &surf->surface_desc)))
744 LPDIRECTDRAWSURFACE7 surface = ICOM_INTERFACE(surf,
745 IDirectDrawSurface7);
747 /* BOGUS! Violates COM rules, but MSDN says so. */
748 IDirectDrawSurface7_AddRef(surface);
750 if (callback(surface, &surf->surface_desc, context)
759 /* I really don't understand how this is supposed to work.
760 * We only consider dwHeight, dwWidth and ddpfPixelFormat.dwFlags. */
762 Main_DirectDraw_EnumCreateableSurfaces(IDirectDrawImpl *This, DWORD dwFlags,
763 LPDDSURFACEDESC2 lpDDSD2,
765 LPDDENUMSURFACESCALLBACK7 callback)
767 FIXME("This isn't going to work.\n");
769 if ((dwFlags & DDENUMSURFACES_MATCHTYPE) != DDENUMSURFACES_MATCH)
770 return DDERR_INVALIDPARAMS;
772 /* TODO: implement this.
773 * Does this work before SCL is called?
774 * Does it only consider off-screen surfaces?
780 /* For unsigned x. 0 is not a power of 2. */
781 #define IS_POW_2(x) (((x) & ((x) - 1)) == 0)
784 Main_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
785 LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
786 LPDDENUMSURFACESCALLBACK7 callback)
788 ICOM_THIS(IDirectDrawImpl, iface);
789 TRACE("(%p)->(0x%lx, %p, %p, %p)\n", iface, dwFlags, lpDDSD2, context,
792 if (callback == NULL)
793 return DDERR_INVALIDPARAMS;
795 if (dwFlags & ~(DDENUMSURFACES_SEARCHTYPE|DDENUMSURFACES_MATCHTYPE))
796 return DDERR_INVALIDPARAMS;
798 if (!IS_POW_2(dwFlags & DDENUMSURFACES_SEARCHTYPE)
799 || !IS_POW_2(dwFlags & DDENUMSURFACES_MATCHTYPE))
800 return DDERR_INVALIDPARAMS;
802 if (dwFlags & DDENUMSURFACES_DOESEXIST)
804 return Main_DirectDraw_EnumExistingSurfaces(This, dwFlags, lpDDSD2,
809 return Main_DirectDraw_EnumCreateableSurfaces(This, dwFlags, lpDDSD2,
815 Main_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b)
817 ICOM_THIS(IDirectDrawImpl,iface);
818 FIXME("(%p)->() stub\n", This);
824 Main_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
826 ICOM_THIS(IDirectDrawImpl,iface);
827 TRACE("(%p)->()\n",This);
832 Main_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
835 ICOM_THIS(IDirectDrawImpl,iface);
836 TRACE("(%p,%p,%p), stub\n",This,pDriverCaps,pHELCaps);
837 if (pDriverCaps != NULL) {
838 DD_STRUCT_COPY_BYSIZE(pDriverCaps,&This->caps);
839 if (TRACE_ON(ddraw)) {
840 DPRINTF("Driver Caps : \n");
841 DDRAW_dump_DDCAPS(pDriverCaps);
844 if (pHELCaps != NULL) {
845 DD_STRUCT_COPY_BYSIZE(pHELCaps,&This->caps);
846 if (TRACE_ON(ddraw)) {
847 DPRINTF("HEL Caps : \n");
848 DDRAW_dump_DDCAPS(pHELCaps);
855 /* GetDeviceIdentifier */
859 Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes,
862 ICOM_THIS(IDirectDrawImpl,iface);
866 FIXME("(%p,%p,%p), stub\n",This,pNumCodes,pCodes);
871 Main_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface,
872 LPDIRECTDRAWSURFACE7 *lplpGDIDDSSurface)
874 ICOM_THIS(IDirectDrawImpl,iface);
875 TRACE("(%p)->(%p)\n", This, lplpGDIDDSSurface);
876 TRACE("returning primary (%p)\n", This->primary_surface);
877 *lplpGDIDDSSurface = ICOM_INTERFACE(This->primary_surface, IDirectDrawSurface7);
878 if (*lplpGDIDDSSurface)
879 IDirectDrawSurface7_AddRef(*lplpGDIDDSSurface);
884 Main_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq)
886 ICOM_THIS(IDirectDrawImpl,iface);
887 FIXME("(%p)->(%p) returns 60 Hz always\n",This,freq);
888 *freq = 60*100; /* 60 Hz */
893 Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
895 ICOM_THIS(IDirectDrawImpl,iface);
896 FIXME("(%p)->(%p)\n", This, lpdwScanLine);
904 Main_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc,
905 LPDIRECTDRAWSURFACE7 *lpDDS)
907 ICOM_THIS(IDirectDrawImpl,iface);
908 FIXME("(%p)->(%08ld,%p)\n", This, (DWORD) hdc, lpDDS);
914 Main_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, LPBOOL status)
916 ICOM_THIS(IDirectDrawImpl,iface);
917 TRACE("(%p)->(%p)\n",This,status);
922 /* If we were not initialised then Uninit_Main_IDirectDraw7_Initialize would
923 * have been called instead. */
925 Main_DirectDraw_Initialize(LPDIRECTDRAW7 iface, LPGUID lpGuid)
927 TRACE("(%p)->(%s)\n", iface, debugstr_guid(lpGuid));
929 return DDERR_ALREADYINITIALIZED;
933 Main_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface)
935 ICOM_THIS(IDirectDrawImpl,iface);
936 IDirectDrawSurfaceImpl* surf;
938 TRACE("(%p)->()\n", This);
940 for (surf = This->surfaces; surf != NULL; surf = surf->next_ddraw)
941 IDirectDrawSurface7_Restore(ICOM_INTERFACE(surf, IDirectDrawSurface7));
946 static void DDRAW_SubclassWindow(IDirectDrawImpl* This)
948 /* Well we don't actually subclass the window yet. */
949 SetPropA(This->window, ddProp, This);
952 static void DDRAW_UnsubclassWindow(IDirectDrawImpl* This)
954 RemovePropA(This->window, ddProp);
958 Main_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hwnd,
961 ICOM_THIS(IDirectDrawImpl,iface);
963 FIXME("(%p)->(%08lx,%08lx)\n",This,(DWORD)hwnd,cooplevel);
964 DDRAW_dump_cooperativelevel(cooplevel);
966 /* Makes realMYST test happy. */
967 if (This->cooperative_level == cooplevel
968 && This->window == hwnd)
971 /* XXX "It cannot be reset while the process has surfaces or palettes
972 * created." Otherwise the window can be changed???
974 * This appears to be wrong - comment it out for now.
976 return DDERR_HWNDALREADYSET;
979 if (!(cooplevel & (DDSCL_EXCLUSIVE|DDSCL_NORMAL)))
980 return DDERR_INVALIDPARAMS;
983 This->cooperative_level = cooplevel;
985 This->local.hWnd = (ULONG_PTR)hwnd;
986 This->local.dwLocalFlags |= DDRAWILCL_SETCOOPCALLED;
987 /* not entirely sure about these */
988 if (cooplevel & DDSCL_EXCLUSIVE) This->local.dwLocalFlags |= DDRAWILCL_HASEXCLUSIVEMODE;
989 if (cooplevel & DDSCL_FULLSCREEN) This->local.dwLocalFlags |= DDRAWILCL_ISFULLSCREEN;
990 if (cooplevel & DDSCL_ALLOWMODEX) This->local.dwLocalFlags |= DDRAWILCL_ALLOWMODEX;
991 if (cooplevel & DDSCL_MULTITHREADED) This->local.dwLocalFlags |= DDRAWILCL_MULTITHREADED;
992 if (cooplevel & DDSCL_FPUSETUP) This->local.dwLocalFlags |= DDRAWILCL_FPUSETUP;
993 if (cooplevel & DDSCL_FPUPRESERVE) This->local.dwLocalFlags |= DDRAWILCL_FPUPRESERVE;
995 if (This->local.lpGbl) {
996 /* assume that this app is the active app (in wine, there's
997 * probably only one app per global ddraw object anyway) */
998 if (cooplevel & DDSCL_EXCLUSIVE) This->local.lpGbl->lpExclusiveOwner = &This->local;
999 else if (This->local.lpGbl->lpExclusiveOwner == &This->local)
1000 This->local.lpGbl->lpExclusiveOwner = NULL;
1001 if (This->set_exclusive_mode)
1002 This->set_exclusive_mode(This, (cooplevel & DDSCL_EXCLUSIVE) != 0);
1005 ShowWindow(hwnd, SW_SHOW);
1007 DDRAW_SubclassWindow(This);
1009 /* TODO Does it also get resized to the current screen size? */
1015 Main_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
1016 DWORD dwHeight, LONG lPitch,
1017 DWORD dwRefreshRate, DWORD dwFlags,
1018 const DDPIXELFORMAT* pixelformat)
1023 ICOM_THIS(IDirectDrawImpl,iface);
1025 TRACE("(%p)->SetDisplayMode(%ld,%ld)\n",This,dwWidth,dwHeight);
1027 if (!(This->cooperative_level & DDSCL_EXCLUSIVE))
1028 return DDERR_NOEXCLUSIVEMODE;
1030 if (!IsWindow(This->window))
1031 return DDERR_GENERIC; /* unchecked */
1033 LosePrimarySurface(This);
1035 screenX = GetSystemMetrics(SM_CXSCREEN);
1036 screenY = GetSystemMetrics(SM_CYSCREEN);
1038 This->width = dwWidth;
1039 This->height = dwHeight;
1040 This->pitch = lPitch;
1041 This->pixelformat = *pixelformat;
1043 /* Position the window in the center of the screen - don't center for now */
1044 /* MoveWindow(This->window, (screenX-dwWidth)/2, (screenY-dwHeight)/2,
1045 dwWidth, dwHeight, TRUE);*/
1046 MoveWindow(This->window, 0, 0, dwWidth, dwHeight, TRUE);
1048 SetFocus(This->window);
1054 Main_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
1056 ICOM_THIS(IDirectDrawImpl,iface);
1058 TRACE("(%p)\n",This);
1059 if (!(This->cooperative_level & DDSCL_EXCLUSIVE))
1060 return DDERR_NOEXCLUSIVEMODE;
1062 /* Lose the primary surface if the resolution changes. */
1063 if (This->orig_width != This->width || This->orig_height != This->height
1064 || This->orig_pitch != This->pitch
1065 || This->orig_pixelformat.dwFlags != This->pixelformat.dwFlags
1066 || !Main_DirectDraw_DDPIXELFORMAT_Match(&This->pixelformat,
1067 &This->orig_pixelformat))
1069 LosePrimarySurface(This);
1072 /* TODO Move the window back where it belongs. */
1078 Main_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
1081 ICOM_THIS(IDirectDrawImpl,iface);
1082 FIXME("(%p)->(flags=0x%08lx,handle=%p)\n",This,dwFlags,h);
1087 Main_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD)
1089 ICOM_THIS(IDirectDrawImpl,iface);
1090 TRACE("(%p)->GetDisplayMode(%p)\n",This,pDDSD);
1092 pDDSD->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_PIXELFORMAT|DDSD_REFRESHRATE;
1093 pDDSD->dwHeight = This->height;
1094 pDDSD->dwWidth = This->width;
1095 pDDSD->u1.lPitch = This->pitch;
1096 pDDSD->u2.dwRefreshRate = 60;
1097 pDDSD->u4.ddpfPixelFormat = This->pixelformat;
1098 pDDSD->ddsCaps.dwCaps = 0;
1103 static INT32 allocate_memory(IDirectDrawImpl *This, DWORD mem)
1105 if (mem > This->available_vidmem) return -1;
1106 This->available_vidmem -= mem;
1107 return This->available_vidmem;
1110 static void free_memory(IDirectDrawImpl *This, DWORD mem)
1112 This->available_vidmem += mem;
1116 Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
1117 LPDWORD total, LPDWORD free)
1119 ICOM_THIS(IDirectDrawImpl,iface);
1120 TRACE("(%p)->(%p,%p,%p)\n", This,ddscaps,total,free);
1122 if (TRACE_ON(ddraw)) {
1123 TRACE(" Asking for memory of type : ");
1124 DDRAW_dump_DDSCAPS2(ddscaps); DPRINTF("\n");
1127 /* We have 16 MB videomemory */
1128 if (total) *total= This->total_vidmem;
1129 if (free) *free = This->available_vidmem;
1131 TRACE(" returning (total) %ld / (free) %ld\n",
1132 total != NULL ? *total : 0,
1133 free != NULL ? *free : 0);
1138 HRESULT WINAPI Main_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface) {
1139 ICOM_THIS(IDirectDrawImpl,iface);
1140 TRACE("(%p)->(): stub\n", This);
1146 Main_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pModes,
1147 DWORD dwNumModes, DWORD dwFlags)
1149 ICOM_THIS(IDirectDrawImpl,iface);
1150 FIXME("(%p)->() stub\n", This);
1155 /*** Owned object management. */
1157 void Main_DirectDraw_AddSurface(IDirectDrawImpl* This,
1158 IDirectDrawSurfaceImpl* surface)
1160 assert(surface->ddraw_owner == NULL || surface->ddraw_owner == This);
1162 surface->ddraw_owner = This;
1164 /* where should it go? */
1165 surface->next_ddraw = This->surfaces;
1166 surface->prev_ddraw = NULL;
1168 This->surfaces->prev_ddraw = surface;
1169 This->surfaces = surface;
1172 void Main_DirectDraw_RemoveSurface(IDirectDrawImpl* This,
1173 IDirectDrawSurfaceImpl* surface)
1175 assert(surface->ddraw_owner == This);
1177 if (This->surfaces == surface)
1178 This->surfaces = surface->next_ddraw;
1180 if (This->primary_surface == surface)
1181 This->primary_surface = NULL;
1183 if (surface->next_ddraw)
1184 surface->next_ddraw->prev_ddraw = surface->prev_ddraw;
1185 if (surface->prev_ddraw)
1186 surface->prev_ddraw->next_ddraw = surface->next_ddraw;
1189 static void Main_DirectDraw_DeleteSurfaces(IDirectDrawImpl* This)
1191 while (This->surfaces != NULL)
1192 Main_DirectDrawSurface_ForceDestroy(This->surfaces);
1195 void Main_DirectDraw_AddClipper(IDirectDrawImpl* This,
1196 IDirectDrawClipperImpl* clipper)
1198 assert(clipper->ddraw_owner == NULL || clipper->ddraw_owner == This);
1200 clipper->ddraw_owner = This;
1202 clipper->next_ddraw = This->clippers;
1203 clipper->prev_ddraw = NULL;
1205 This->clippers->prev_ddraw = clipper;
1206 This->clippers = clipper;
1209 void Main_DirectDraw_RemoveClipper(IDirectDrawImpl* This,
1210 IDirectDrawClipperImpl* clipper)
1212 assert(clipper->ddraw_owner == This);
1214 if (This->clippers == clipper)
1215 This->clippers = clipper->next_ddraw;
1217 if (clipper->next_ddraw)
1218 clipper->next_ddraw->prev_ddraw = clipper->prev_ddraw;
1219 if (clipper->prev_ddraw)
1220 clipper->prev_ddraw->next_ddraw = clipper->next_ddraw;
1223 static void Main_DirectDraw_DeleteClippers(IDirectDrawImpl* This)
1225 while (This->clippers != NULL)
1226 Main_DirectDrawClipper_ForceDestroy(This->clippers);
1229 void Main_DirectDraw_AddPalette(IDirectDrawImpl* This,
1230 IDirectDrawPaletteImpl* palette)
1232 assert(palette->ddraw_owner == NULL || palette->ddraw_owner == This);
1234 palette->ddraw_owner = This;
1236 /* where should it go? */
1237 palette->next_ddraw = This->palettes;
1238 palette->prev_ddraw = NULL;
1240 This->palettes->prev_ddraw = palette;
1241 This->palettes = palette;
1244 void Main_DirectDraw_RemovePalette(IDirectDrawImpl* This,
1245 IDirectDrawPaletteImpl* palette)
1247 assert(palette->ddraw_owner == This);
1249 if (This->palettes == palette)
1250 This->palettes = palette->next_ddraw;
1252 if (palette->next_ddraw)
1253 palette->next_ddraw->prev_ddraw = palette->prev_ddraw;
1254 if (palette->prev_ddraw)
1255 palette->prev_ddraw->next_ddraw = palette->next_ddraw;
1258 static void Main_DirectDraw_DeletePalettes(IDirectDrawImpl* This)
1260 while (This->palettes != NULL)
1261 Main_DirectDrawPalette_ForceDestroy(This->palettes);
1267 LoseSurface(IDirectDrawSurfaceImpl *surface)
1269 if (surface != NULL) surface->lose_surface(surface);
1273 LosePrimarySurface(IDirectDrawImpl *This)
1275 /* MSDN: "If another application changes the display mode, the primary
1276 * surface is lost, and the method returns DDERR_SURFACELOST until the
1277 * primary surface is recreated to match the new display mode."
1279 * We mark all the primary surfaces as lost as soon as the display
1280 * mode is changed (by any application). */
1282 LoseSurface(This->primary_surface);
1285 /******************************************************************************
1286 * Uninitialised DirectDraw functions
1288 * This vtable is used when a DirectDraw object is created with
1289 * CoCreateInstance. The only usable method is Initialize.
1292 void Uninit_DirectDraw_final_release(IDirectDrawImpl *This)
1294 Main_DirectDraw_final_release(This);
1297 static ICOM_VTABLE(IDirectDraw7) Uninit_DirectDraw_VTable;
1299 /* Not called from the vtable. */
1300 HRESULT Uninit_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
1304 hr = Main_DirectDraw_Construct(This, ex);
1305 if (FAILED(hr)) return hr;
1307 This->final_release = Uninit_DirectDraw_final_release;
1308 ICOM_INIT_INTERFACE(This, IDirectDraw7, Uninit_DirectDraw_VTable);
1313 HRESULT Uninit_DirectDraw_Create(const GUID* pGUID,
1314 LPDIRECTDRAW7* pIface,
1315 IUnknown* pUnkOuter, BOOL ex)
1318 IDirectDrawImpl* This;
1320 assert(pUnkOuter == NULL); /* XXX no: we must check this */
1322 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
1323 sizeof(IDirectDrawImpl));
1324 if (This == NULL) return E_OUTOFMEMORY;
1326 hr = Uninit_DirectDraw_Construct(This, ex);
1328 HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY, This);
1330 *pIface = ICOM_INTERFACE(This, IDirectDraw7);
1335 static HRESULT WINAPI
1336 Uninit_DirectDraw_Initialize(LPDIRECTDRAW7 iface, LPGUID pDeviceGuid)
1338 const ddraw_driver* driver;
1339 ICOM_THIS(IDirectDrawImpl, iface);
1341 TRACE("(%p)->(%p)\n", iface, pDeviceGuid);
1343 driver = DDRAW_FindDriver(pDeviceGuid);
1344 /* XXX This return value is not documented. (Not checked.) */
1345 if (driver == NULL) return DDERR_INVALIDDIRECTDRAWGUID;
1347 return driver->init(This, pDeviceGuid);
1350 static HRESULT WINAPI
1351 Uninit_DirectDraw_Compact(LPDIRECTDRAW7 iface)
1353 return DDERR_NOTINITIALIZED;
1356 static HRESULT WINAPI
1357 Uninit_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface, DWORD dwFlags,
1358 LPDIRECTDRAWCLIPPER *lplpDDClipper,
1359 IUnknown *pUnkOuter)
1362 return DDERR_NOTINITIALIZED;
1365 static HRESULT WINAPI
1366 Uninit_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
1367 LPPALETTEENTRY lpColorTable,
1368 LPDIRECTDRAWPALETTE *lplpDDPalette,
1369 IUnknown *pUnkOuter)
1371 return DDERR_NOTINITIALIZED;
1374 static HRESULT WINAPI
1375 Uninit_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface,
1376 LPDDSURFACEDESC2 lpDDSurfaceDesc,
1377 LPDIRECTDRAWSURFACE7 *lplpDDSurface,
1378 IUnknown *pUnkOuter)
1380 return DDERR_NOTINITIALIZED;
1383 static HRESULT WINAPI
1384 Uninit_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface,
1385 LPDIRECTDRAWSURFACE7 pSurf,
1386 LPDIRECTDRAWSURFACE7 *pDupSurf)
1389 return DDERR_NOTINITIALIZED;
1392 static HRESULT WINAPI
1393 Uninit_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
1394 LPDDSURFACEDESC2 lpDDSD,
1396 LPDDENUMMODESCALLBACK2 cb)
1398 return DDERR_NOTINITIALIZED;
1401 static HRESULT WINAPI
1402 Uninit_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
1403 LPDDSURFACEDESC2 pDDSD, LPVOID context,
1404 LPDDENUMSURFACESCALLBACK7 cb)
1406 return DDERR_NOTINITIALIZED;
1409 static HRESULT WINAPI
1410 Uninit_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
1412 return DDERR_NOTINITIALIZED;
1415 static HRESULT WINAPI
1416 Uninit_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
1419 return DDERR_NOTINITIALIZED;
1422 static HRESULT WINAPI
1423 Uninit_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface,
1424 LPDDSURFACEDESC2 pDDSD)
1426 return DDERR_NOTINITIALIZED;
1429 static HRESULT WINAPI
1430 Uninit_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes,
1433 return DDERR_NOTINITIALIZED;
1436 static HRESULT WINAPI
1437 Uninit_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface,
1438 LPDIRECTDRAWSURFACE7 *pGDISurf)
1440 return DDERR_NOTINITIALIZED;
1443 static HRESULT WINAPI
1444 Uninit_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface, LPDWORD pdwFreq)
1446 return DDERR_NOTINITIALIZED;
1449 static HRESULT WINAPI
1450 Uninit_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD pdwScanLine)
1452 return DDERR_NOTINITIALIZED;
1455 static HRESULT WINAPI
1456 Uninit_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, PBOOL pbIsInVB)
1458 return DDERR_NOTINITIALIZED;
1461 static HRESULT WINAPI
1462 Uninit_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
1464 return DDERR_NOTINITIALIZED;
1467 static HRESULT WINAPI
1468 Uninit_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hWnd,
1471 return DDERR_NOTINITIALIZED;
1474 static HRESULT WINAPI
1475 Uninit_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
1476 DWORD dwHeight, DWORD dwBPP,
1477 DWORD dwRefreshRate, DWORD dwFlags)
1479 return DDERR_NOTINITIALIZED;
1482 static HRESULT WINAPI
1483 Uninit_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
1486 return DDERR_NOTINITIALIZED;
1489 static HRESULT WINAPI
1490 Uninit_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 pDDCaps,
1491 LPDWORD pdwTotal, LPDWORD pdwFree)
1493 return DDERR_NOTINITIALIZED;
1496 static HRESULT WINAPI
1497 Uninit_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hDC,
1498 LPDIRECTDRAWSURFACE7 *pSurf)
1500 return DDERR_NOTINITIALIZED;
1503 static HRESULT WINAPI
1504 Uninit_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface)
1506 return DDERR_NOTINITIALIZED;
1509 static HRESULT WINAPI
1510 Uninit_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface)
1512 return DDERR_NOTINITIALIZED;
1515 static HRESULT WINAPI
1516 Uninit_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
1517 LPDDDEVICEIDENTIFIER2 pDDDI,
1520 return DDERR_NOTINITIALIZED;
1523 static HRESULT WINAPI
1524 Uninit_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pszModes,
1525 DWORD cModes, DWORD dwFlags)
1527 return DDERR_NOTINITIALIZED;
1530 static HRESULT WINAPI
1531 Uninit_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface, DWORD dwFlags,
1534 return DDERR_NOTINITIALIZED;
1537 static ICOM_VTABLE(IDirectDraw7) Uninit_DirectDraw_VTable =
1539 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1540 Main_DirectDraw_QueryInterface,
1541 Main_DirectDraw_AddRef,
1542 Main_DirectDraw_Release,
1543 Uninit_DirectDraw_Compact,
1544 Uninit_DirectDraw_CreateClipper,
1545 Uninit_DirectDraw_CreatePalette,
1546 Uninit_DirectDraw_CreateSurface,
1547 Uninit_DirectDraw_DuplicateSurface,
1548 Uninit_DirectDraw_EnumDisplayModes,
1549 Uninit_DirectDraw_EnumSurfaces,
1550 Uninit_DirectDraw_FlipToGDISurface,
1551 Uninit_DirectDraw_GetCaps,
1552 Uninit_DirectDraw_GetDisplayMode,
1553 Uninit_DirectDraw_GetFourCCCodes,
1554 Uninit_DirectDraw_GetGDISurface,
1555 Uninit_DirectDraw_GetMonitorFrequency,
1556 Uninit_DirectDraw_GetScanLine,
1557 Uninit_DirectDraw_GetVerticalBlankStatus,
1558 Uninit_DirectDraw_Initialize,
1559 Uninit_DirectDraw_RestoreDisplayMode,
1560 Uninit_DirectDraw_SetCooperativeLevel,
1561 Uninit_DirectDraw_SetDisplayMode,
1562 Uninit_DirectDraw_WaitForVerticalBlank,
1563 Uninit_DirectDraw_GetAvailableVidMem,
1564 Uninit_DirectDraw_GetSurfaceFromDC,
1565 Uninit_DirectDraw_RestoreAllSurfaces,
1566 Uninit_DirectDraw_TestCooperativeLevel,
1567 Uninit_DirectDraw_GetDeviceIdentifier,
1568 Uninit_DirectDraw_StartModeTest,
1569 Uninit_DirectDraw_EvaluateMode