1 /* DirectDrawSurface base implementation
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
29 #define NONAMELESSUNION
30 #define NONAMELESSSTRUCT
33 #include "wine/debug.h"
34 #include "ddraw_private.h"
35 #include "opengl_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
38 WINE_DECLARE_DEBUG_CHANNEL(ddraw_flip);
39 WINE_DECLARE_DEBUG_CHANNEL(ddraw_fps);
41 /** Creation/Destruction functions */
44 Main_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl *This,
46 const DDSURFACEDESC2 *pDDSD)
48 TRACE("(%p)->(%p,%p)\n", This, pDD, pDDSD);
50 if (pDDSD != &This->surface_desc) {
51 This->surface_desc.dwSize = sizeof(This->surface_desc);
52 DD_STRUCT_COPY_BYSIZE(&(This->surface_desc),pDDSD);
54 This->uniqueness_value = 1; /* unchecked */
57 This->local.lpSurfMore = &This->more;
58 This->local.lpGbl = &This->global;
59 This->local.dwProcessId = GetCurrentProcessId();
60 This->local.dwFlags = 0; /* FIXME */
61 This->local.ddsCaps.dwCaps = This->surface_desc.ddsCaps.dwCaps;
62 /* FIXME: more local stuff */
63 This->more.lpDD_lcl = &pDD->local;
64 This->more.ddsCapsEx.dwCaps2 = This->surface_desc.ddsCaps.dwCaps2;
65 This->more.ddsCapsEx.dwCaps3 = This->surface_desc.ddsCaps.dwCaps3;
66 This->more.ddsCapsEx.dwCaps4 = This->surface_desc.ddsCaps.dwCaps4;
67 /* FIXME: more more stuff */
68 This->gmore = &This->global_more;
69 This->global.u3.lpDD = pDD->local.lpGbl;
70 /* FIXME: more global stuff */
72 This->final_release = Main_DirectDrawSurface_final_release;
73 This->late_allocate = Main_DirectDrawSurface_late_allocate;
74 This->attach = Main_DirectDrawSurface_attach;
75 This->detach = Main_DirectDrawSurface_detach;
76 This->lock_update = Main_DirectDrawSurface_lock_update;
77 This->unlock_update = Main_DirectDrawSurface_unlock_update;
78 This->lose_surface = Main_DirectDrawSurface_lose_surface;
79 This->set_palette = Main_DirectDrawSurface_set_palette;
80 This->update_palette = Main_DirectDrawSurface_update_palette;
81 This->get_display_window = Main_DirectDrawSurface_get_display_window;
82 This->get_gamma_ramp = Main_DirectDrawSurface_get_gamma_ramp;
83 This->set_gamma_ramp = Main_DirectDrawSurface_set_gamma_ramp;
85 ICOM_INIT_INTERFACE(This, IDirectDrawSurface3,
86 DDRAW_IDDS3_Thunk_VTable);
87 ICOM_INIT_INTERFACE(This, IDirectDrawGammaControl,
90 /* There is no generic implementation of IDDS7 or texture */
92 Main_DirectDraw_AddSurface(pDD, This);
96 void Main_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This)
98 Main_DirectDraw_RemoveSurface(This->ddraw_owner, This);
101 HRESULT Main_DirectDrawSurface_late_allocate(IDirectDrawSurfaceImpl* This)
106 static void Main_DirectDrawSurface_Destroy(IDirectDrawSurfaceImpl* This)
109 IDirectDrawPalette_Release(ICOM_INTERFACE(This->palette, IDirectDrawPalette));
110 This->palette = NULL;
112 This->final_release(This);
113 if (This->private != This+1) HeapFree(GetProcessHeap(), 0, This->private);
114 if (This->tex_private) HeapFree(GetProcessHeap(), 0, This->tex_private);
115 HeapFree(GetProcessHeap(), 0, This);
118 void Main_DirectDrawSurface_ForceDestroy(IDirectDrawSurfaceImpl* This)
120 WARN("destroying surface %p with refcnt %lu\n", This, This->ref);
121 Main_DirectDrawSurface_Destroy(This);
124 ULONG WINAPI Main_DirectDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface)
126 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
127 ULONG ref = InterlockedDecrement(&This->ref);
129 TRACE("(%p)->(): decreasing from %ld\n", This, ref + 1);
133 if (This->aux_release)
134 This->aux_release(This->aux_ctx, This->aux_data);
135 Main_DirectDrawSurface_Destroy(This);
137 TRACE("released surface %p\n", This);
145 ULONG WINAPI Main_DirectDrawSurface_AddRef(LPDIRECTDRAWSURFACE7 iface)
147 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
148 ULONG ref = InterlockedIncrement(&This->ref);
150 TRACE("(%p)->(): increasing from %ld\n", This, ref - 1);
156 Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
159 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
160 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppObj);
164 if (IsEqualGUID(&IID_IUnknown, riid)
165 || IsEqualGUID(&IID_IDirectDrawSurface7, riid)
166 || IsEqualGUID(&IID_IDirectDrawSurface4, riid))
168 InterlockedIncrement(&This->ref);
169 *ppObj = ICOM_INTERFACE(This, IDirectDrawSurface7);
172 else if (IsEqualGUID(&IID_IDirectDrawSurface, riid)
173 || IsEqualGUID(&IID_IDirectDrawSurface2, riid)
174 || IsEqualGUID(&IID_IDirectDrawSurface3, riid))
176 InterlockedIncrement(&This->ref);
177 *ppObj = ICOM_INTERFACE(This, IDirectDrawSurface3);
180 else if (IsEqualGUID(&IID_IDirectDrawGammaControl, riid))
182 InterlockedIncrement(&This->ref);
183 *ppObj = ICOM_INTERFACE(This, IDirectDrawGammaControl);
187 /* interfaces following here require OpenGL */
188 if( !opengl_initialized )
189 return E_NOINTERFACE;
191 if ( IsEqualGUID( &IID_D3DDEVICE_OpenGL, riid ) ||
192 IsEqualGUID( &IID_IDirect3DHALDevice, riid) )
194 IDirect3DDeviceImpl *d3ddevimpl;
197 ret_value = d3ddevice_create(&d3ddevimpl, This->ddraw_owner, This, 1);
198 if (FAILED(ret_value)) return ret_value;
200 *ppObj = ICOM_INTERFACE(d3ddevimpl, IDirect3DDevice);
201 TRACE(" returning Direct3DDevice interface at %p.\n", *ppObj);
203 InterlockedIncrement(&This->ref); /* No idea if this is correct.. Need to check using real Windows */
206 else if (IsEqualGUID( &IID_IDirect3DTexture, riid ) ||
207 IsEqualGUID( &IID_IDirect3DTexture2, riid ))
209 HRESULT ret_value = S_OK;
211 /* Note: this is not exactly how Windows does it... But this seems not to hurt the only
212 application I know creating a texture without this flag set and it will prevent
213 bugs in other parts of Wine.
215 This->surface_desc.ddsCaps.dwCaps |= DDSCAPS_TEXTURE;
217 /* In case the texture surface was created before the D3D creation */
218 if (This->tex_private == NULL) {
219 if (This->ddraw_owner->d3d_private == NULL) {
220 ERR("Texture created with no D3D object yet.. Not supported !\n");
221 return E_NOINTERFACE;
224 ret_value = This->ddraw_owner->d3d_create_texture(This->ddraw_owner, This, FALSE, This->mip_main);
225 if (FAILED(ret_value)) return ret_value;
227 if (IsEqualGUID( &IID_IDirect3DTexture, riid )) {
228 *ppObj = ICOM_INTERFACE(This, IDirect3DTexture);
229 TRACE(" returning Direct3DTexture interface at %p.\n", *ppObj);
231 *ppObj = ICOM_INTERFACE(This, IDirect3DTexture2);
232 TRACE(" returning Direct3DTexture2 interface at %p.\n", *ppObj);
234 InterlockedIncrement(&This->ref);
239 return E_NOINTERFACE;
245 Main_DirectDrawSurface_attach(IDirectDrawSurfaceImpl *This,
246 IDirectDrawSurfaceImpl *to)
251 BOOL Main_DirectDrawSurface_detach(IDirectDrawSurfaceImpl *This)
257 Main_DirectDrawSurface_lock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect,
263 Main_DirectDrawSurface_unlock_update(IDirectDrawSurfaceImpl* This,
269 Main_DirectDrawSurface_lose_surface(IDirectDrawSurfaceImpl* This)
274 Main_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
275 IDirectDrawPaletteImpl* pal)
280 Main_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl* This,
281 IDirectDrawPaletteImpl* pal,
282 DWORD dwStart, DWORD dwCount,
283 LPPALETTEENTRY palent)
288 Main_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This)
294 Main_DirectDrawSurface_get_gamma_ramp(IDirectDrawSurfaceImpl* This,
296 LPDDGAMMARAMP lpGammaRamp)
300 hr = This->get_dc(This, &hDC);
301 if (FAILED(hr)) return hr;
302 hr = GetDeviceGammaRamp(hDC, lpGammaRamp) ? DD_OK : DDERR_UNSUPPORTED;
303 This->release_dc(This, hDC);
308 Main_DirectDrawSurface_set_gamma_ramp(IDirectDrawSurfaceImpl* This,
310 LPDDGAMMARAMP lpGammaRamp)
314 hr = This->get_dc(This, &hDC);
315 if (FAILED(hr)) return hr;
316 hr = SetDeviceGammaRamp(hDC, lpGammaRamp) ? DD_OK : DDERR_UNSUPPORTED;
317 This->release_dc(This, hDC);
322 /*** Interface functions */
325 Main_DirectDrawSurface_AddAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
326 LPDIRECTDRAWSURFACE7 pAttach)
328 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
329 IDirectDrawSurfaceImpl* surf = ICOM_OBJECT(IDirectDrawSurfaceImpl,
330 IDirectDrawSurface7, pAttach);
332 TRACE("(%p)->(%p)\n",This,pAttach);
334 /* Does windows check this? */
336 return DDERR_CANNOTATTACHSURFACE; /* unchecked */
338 /* Does windows check this? */
339 if (surf->ddraw_owner != This->ddraw_owner)
340 return DDERR_CANNOTATTACHSURFACE; /* unchecked */
342 if (surf->surface_owner != NULL)
343 return DDERR_SURFACEALREADYATTACHED; /* unchecked */
345 /* TODO MSDN: "You can attach only z-buffer surfaces with this method."
346 * But apparently backbuffers and mipmaps can be attached too. */
348 /* Set MIPMAPSUBLEVEL if this seems to be one */
349 if (This->surface_desc.ddsCaps.dwCaps &
350 surf->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) {
351 surf->surface_desc.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL;
352 /* FIXME: we should probably also add to dwMipMapCount of this
353 * and all parent surfaces (update create_texture if you do) */
356 /* Callback to allow the surface to do something special now that it is
357 * attached. (e.g. maybe the Z-buffer tells the renderer to use it.) */
358 if (!surf->attach(surf, This))
359 return DDERR_CANNOTATTACHSURFACE;
361 /* check: Where should it go in the chain? This puts it on the head. */
363 This->attached->prev_attached = surf;
364 surf->next_attached = This->attached;
365 surf->prev_attached = NULL;
366 This->attached = surf;
367 surf->surface_owner = This;
369 IDirectDrawSurface7_AddRef(pAttach);
374 /* MSDN: "not currently implemented." */
376 Main_DirectDrawSurface_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE7 iface,
379 TRACE("(%p)->(%p)\n",iface,pRect);
380 return DDERR_UNSUPPORTED; /* unchecked */
383 /* MSDN: "not currently implemented." */
385 Main_DirectDrawSurface_BltBatch(LPDIRECTDRAWSURFACE7 iface,
386 LPDDBLTBATCH pBatch, DWORD dwCount,
389 TRACE("(%p)->(%p,%ld,%08lx)\n",iface,pBatch,dwCount,dwFlags);
390 return DDERR_UNSUPPORTED; /* unchecked */
394 Main_DirectDrawSurface_ChangeUniquenessValue(LPDIRECTDRAWSURFACE7 iface)
396 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
397 volatile IDirectDrawSurfaceImpl* vThis = This;
399 TRACE("(%p)\n",This);
400 /* A uniquness value of 0 is apparently special.
401 * This needs to be checked. */
404 DWORD old_uniqueness_value = vThis->uniqueness_value;
405 DWORD new_uniqueness_value = old_uniqueness_value+1;
407 if (old_uniqueness_value == 0) break;
408 if (new_uniqueness_value == 0) new_uniqueness_value = 1;
410 if (InterlockedCompareExchange((LONG*)&vThis->uniqueness_value,
411 old_uniqueness_value,
412 new_uniqueness_value)
413 == old_uniqueness_value)
421 Main_DirectDrawSurface_DeleteAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
423 LPDIRECTDRAWSURFACE7 pAttach)
425 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
426 IDirectDrawSurfaceImpl* surf = ICOM_OBJECT(IDirectDrawSurfaceImpl,
427 IDirectDrawSurface7, pAttach);
429 TRACE("(%p)->(%08lx,%p)\n",This,dwFlags,pAttach);
431 if (!surf || (surf->surface_owner != This))
432 return DDERR_SURFACENOTATTACHED; /* unchecked */
436 /* Remove MIPMAPSUBLEVEL if this seemed to be one */
437 if (This->surface_desc.ddsCaps.dwCaps &
438 surf->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) {
439 surf->surface_desc.ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL;
440 /* FIXME: we should probably also subtract from dwMipMapCount of this
441 * and all parent surfaces */
444 if (surf->next_attached)
445 surf->next_attached->prev_attached = surf->prev_attached;
446 if (surf->prev_attached)
447 surf->prev_attached->next_attached = surf->next_attached;
448 if (This->attached == surf)
449 This->attached = surf->next_attached;
451 IDirectDrawSurface7_Release(pAttach);
457 Main_DirectDrawSurface_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE7 iface,
459 LPDDENUMSURFACESCALLBACK7 cb)
461 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
462 IDirectDrawSurfaceImpl* surf;
464 TRACE("(%p)->(%p,%p)\n",This,context,cb);
466 for (surf = This->attached; surf != NULL; surf = surf->next_attached)
468 /* check: != DDENUMRET_OK or == DDENUMRET_CANCEL? */
469 if (cb(ICOM_INTERFACE(surf, IDirectDrawSurface7), &surf->surface_desc,
470 context) == DDENUMRET_CANCEL)
478 Main_DirectDrawSurface_EnumOverlayZOrders(LPDIRECTDRAWSURFACE7 iface,
479 DWORD dwFlags, LPVOID context,
480 LPDDENUMSURFACESCALLBACK7 cb)
482 TRACE("(%p)->(%08lx,%p,%p)\n",iface,dwFlags,context,cb);
486 BOOL Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
487 IDirectDrawSurfaceImpl* back,
490 /* uniqueness_value? */
491 /* This is necessary. But is it safe? */
493 HDC tmp = front->hDC;
494 front->hDC = back->hDC;
499 BOOL tmp = front->dc_in_use;
500 front->dc_in_use = back->dc_in_use;
501 back->dc_in_use = tmp;
505 FLATPTR tmp = front->global.fpVidMem;
506 front->global.fpVidMem = back->global.fpVidMem;
507 back->global.fpVidMem = tmp;
511 ULONG_PTR tmp = front->global_more.hKernelSurface;
512 front->global_more.hKernelSurface = back->global_more.hKernelSurface;
513 back->global_more.hKernelSurface = tmp;
519 /* This is unnecessarely complicated :-) */
520 #define MEASUREMENT_WINDOW 5
521 #define NUMBER_OF_WINDOWS 10
523 static LONGLONG perf_freq;
524 static LONGLONG perf_storage[NUMBER_OF_WINDOWS];
525 static LONGLONG prev_time = 0;
526 static unsigned int current_window;
527 static unsigned int measurements_in_window;
528 static unsigned int valid_windows;
531 Main_DirectDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface,
532 LPDIRECTDRAWSURFACE7 override, DWORD dwFlags)
534 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
535 IDirectDrawSurfaceImpl* target;
538 TRACE("(%p)->(%p,%08lx)\n",This,override,dwFlags);
540 if (TRACE_ON(ddraw_fps)) {
541 LONGLONG current_time;
542 LONGLONG frame_duration;
543 QueryPerformanceCounter((LARGE_INTEGER *) ¤t_time);
545 if (prev_time != 0) {
546 LONGLONG total_time = 0;
549 frame_duration = current_time - prev_time;
550 prev_time = current_time;
552 perf_storage[current_window] += frame_duration;
553 measurements_in_window++;
555 if (measurements_in_window >= MEASUREMENT_WINDOW) {
559 if (valid_windows < NUMBER_OF_WINDOWS) {
561 tot_meas = valid_windows * MEASUREMENT_WINDOW;
562 for (i = 0; i < valid_windows; i++) {
563 total_time += perf_storage[i];
567 tot_meas = NUMBER_OF_WINDOWS * MEASUREMENT_WINDOW;
568 for (i = 0; i < NUMBER_OF_WINDOWS; i++) {
569 total_time += perf_storage[i];
573 TRACE_(ddraw_fps)(" %9.5f\n", (double) (perf_freq * tot_meas) / (double) total_time);
575 if (current_window >= NUMBER_OF_WINDOWS) {
578 perf_storage[current_window] = 0;
579 measurements_in_window = 0;
582 prev_time = current_time;
583 memset(perf_storage, 0, sizeof(perf_storage));
586 measurements_in_window = 0;
587 QueryPerformanceFrequency((LARGE_INTEGER *) &perf_freq);
591 /* MSDN: "This method can be called only for a surface that has the
592 * DDSCAPS_FLIP and DDSCAPS_FRONTBUFFER capabilities." */
593 if ((This->surface_desc.ddsCaps.dwCaps&(DDSCAPS_FLIP|DDSCAPS_FRONTBUFFER))
594 != (DDSCAPS_FLIP|DDSCAPS_FRONTBUFFER))
595 return DDERR_NOTFLIPPABLE;
598 if (This->aux_flip(This->aux_ctx, This->aux_data))
601 /* 1. find the flip target */
602 /* XXX I don't think this algorithm works for more than 1 backbuffer. */
603 if (override == NULL)
605 static DDSCAPS2 back_caps = { DDSCAPS_BACKBUFFER };
606 LPDIRECTDRAWSURFACE7 tgt;
608 hr = IDirectDrawSurface7_GetAttachedSurface(iface, &back_caps, &tgt);
609 if (FAILED(hr)) return DDERR_NOTFLIPPABLE; /* unchecked */
611 target = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
613 IDirectDrawSurface7_Release(tgt);
617 BOOL on_chain = FALSE;
618 IDirectDrawSurfaceImpl* surf;
620 /* MSDN: "The method fails if the specified [override] surface is not
621 * a member of the flipping chain." */
623 /* Verify that override is on this flip chain. We assume that
624 * surf is the head of the flipping chain, because it's the front
626 target = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7,
629 /* Either target is (indirectly) attached to This or This is
630 * (indirectly) attached to target. */
631 for (surf = target; surf != NULL; surf = surf->surface_owner)
641 return DDERR_INVALIDPARAMS; /* unchecked */
644 TRACE("flip to backbuffer: %p\n",target);
645 if (TRACE_ON(ddraw_flip)) {
646 static unsigned int flip_count = 0;
647 IDirectDrawPaletteImpl *palette;
651 /* Hack for paletted games... */
652 palette = target->palette;
653 target->palette = This->palette;
655 sprintf(buf, "flip_%08d.ppm", flip_count++);
656 TRACE_(ddraw_flip)("Dumping file %s to disk.\n", buf);
657 f = fopen(buf, "wb");
658 DDRAW_dump_surface_to_disk(target, f, 8);
659 target->palette = palette;
662 if (This->flip_data(This, target, dwFlags))
663 This->flip_update(This, dwFlags);
668 static PrivateData* find_private_data(IDirectDrawSurfaceImpl *This,
672 for (data = This->private_data; data != NULL; data = data->next)
674 if (IsEqualGUID(&data->tag, tag)) break;
681 Main_DirectDrawSurface_FreePrivateData(LPDIRECTDRAWSURFACE7 iface, REFGUID tag)
683 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
686 data = find_private_data(This, tag);
687 if (data == NULL) return DDERR_NOTFOUND;
690 data->prev->next = data->next;
692 data->next->prev = data->prev;
694 if (data->flags & DDSPD_IUNKNOWNPTR)
696 if (data->ptr.object != NULL)
697 IUnknown_Release(data->ptr.object);
700 HeapFree(GetProcessHeap(), 0, data->ptr.data);
702 HeapFree(GetProcessHeap(), 0, data);
708 Main_DirectDrawSurface_GetAttachedSurface(LPDIRECTDRAWSURFACE7 iface,
710 LPDIRECTDRAWSURFACE7* ppSurface)
712 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
713 IDirectDrawSurfaceImpl* surf;
714 IDirectDrawSurfaceImpl* found = NULL;
717 if (TRACE_ON(ddraw)) {
718 TRACE("(%p)->Looking for caps: %lx,%lx,%lx,%lx output: %p\n",This,pCaps->dwCaps, pCaps->dwCaps2,
719 pCaps->dwCaps3, pCaps->dwCaps4, ppSurface);
720 TRACE(" Caps are : "); DDRAW_dump_DDSCAPS2(pCaps); TRACE("\n");
724 if ((This->ddraw_owner->local.dwLocalFlags & DDRAWILCL_DIRECTDRAW7) == 0) {
725 /* As this is not a DirectDraw7 application, remove the garbage that some games
726 put in the new fields of the DDSCAPS2 structure. */
727 our_caps.dwCaps2 = 0;
728 our_caps.dwCaps3 = 0;
729 our_caps.dwCaps4 = 0;
730 if (TRACE_ON(ddraw)) {
731 TRACE(" Real caps are : "); DDRAW_dump_DDSCAPS2(&our_caps); TRACE("\n");
735 for (surf = This->attached; surf != NULL; surf = surf->next_attached)
737 if (TRACE_ON(ddraw)) {
738 TRACE("Surface: (%p) caps: %lx,%lx,%lx,%lx \n",surf ,
739 surf->surface_desc.ddsCaps.dwCaps,
740 surf->surface_desc.ddsCaps.dwCaps2,
741 surf->surface_desc.ddsCaps.dwCaps3,
742 surf->surface_desc.ddsCaps.dwCaps4);
743 TRACE(" Surface caps are : "); DDRAW_dump_DDSCAPS2(&(surf->surface_desc.ddsCaps)); TRACE("\n");
745 if (((surf->surface_desc.ddsCaps.dwCaps & our_caps.dwCaps) == our_caps.dwCaps) &&
746 ((surf->surface_desc.ddsCaps.dwCaps2 & our_caps.dwCaps2) == our_caps.dwCaps2))
748 /* MSDN: "This method fails if more than one surface is attached
749 * that matches the capabilities requested." */
752 FIXME("More than one attached surface matches requested caps. What should we do here?\n");
753 /* Previous code returned 'DDERR_NOTFOUND'. That appears not
754 to be correct, given what 3DMark expects from MipMapped surfaces.
755 We shall just continue instead. */
763 TRACE("Did not find any valid surface\n");
764 return DDERR_NOTFOUND;
767 *ppSurface = ICOM_INTERFACE(found, IDirectDrawSurface7);
769 if (TRACE_ON(ddraw)) {
770 TRACE("Returning surface %p with description : \n", *ppSurface);
771 DDRAW_dump_surface_desc(&(found->surface_desc));
774 /* XXX d3dframe.cpp sometimes AddRefs things that it gets from us. */
775 IDirectDrawSurface7_AddRef(ICOM_INTERFACE(found, IDirectDrawSurface7));
780 Main_DirectDrawSurface_GetBltStatus(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags)
782 TRACE("(%p)->(%08lx)\n",iface,dwFlags);
787 case DDGBS_ISBLTDONE:
791 return DDERR_INVALIDPARAMS;
796 Main_DirectDrawSurface_GetCaps(LPDIRECTDRAWSURFACE7 iface, LPDDSCAPS2 pCaps)
798 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
800 TRACE("(%p)->(%p)\n",This,pCaps);
801 *pCaps = This->surface_desc.ddsCaps;
806 Main_DirectDrawSurface_GetClipper(LPDIRECTDRAWSURFACE7 iface,
807 LPDIRECTDRAWCLIPPER* ppClipper)
809 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
811 TRACE("(%p)->(%p)\n",This,ppClipper);
812 if (This->clipper == NULL)
813 return DDERR_NOCLIPPERATTACHED;
815 *ppClipper = ICOM_INTERFACE(This->clipper, IDirectDrawClipper);
816 IDirectDrawClipper_AddRef(ICOM_INTERFACE(This->clipper,
817 IDirectDrawClipper));
822 Main_DirectDrawSurface_GetColorKey(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags,
825 /* There is a DDERR_NOCOLORKEY error, but how do we know if a color key
826 * isn't there? That's like saying that an int isn't there. (Which MS
827 * has done in other docs.) */
829 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
831 TRACE("(%p)->(%08lx,%p)\n",This,dwFlags,pCKey);
832 if (TRACE_ON(ddraw)) {
833 TRACE(" - colorkey flags : ");
834 DDRAW_dump_colorkeyflag(dwFlags);
840 *pCKey = This->surface_desc.ddckCKDestBlt;
843 case DDCKEY_DESTOVERLAY:
844 *pCKey = This->surface_desc.u3.ddckCKDestOverlay;
848 *pCKey = This->surface_desc.ddckCKSrcBlt;
851 case DDCKEY_SRCOVERLAY:
852 *pCKey = This->surface_desc.ddckCKSrcOverlay;
856 return DDERR_INVALIDPARAMS;
862 /* XXX We need to do something with the DC if the surface gets lost. */
864 Main_DirectDrawSurface_GetDC(LPDIRECTDRAWSURFACE7 iface, HDC *phDC)
868 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
870 TRACE("(%p)->(%p)\n",This,phDC);
878 return DDERR_DCALREADYCREATED;
882 * Strange: Lock lists DDERR_SURFACEBUSY as an error, meaning that another
883 * thread has it locked, but GetDC does not. */
884 ddsd.dwSize = sizeof(ddsd);
885 hr = IDirectDrawSurface7_Lock(iface, NULL, &ddsd, 0, 0);
892 hr = This->get_dc(This, &This->hDC);
895 TRACE("returning %p\n",This->hDC);
898 This->dc_in_use = TRUE;
900 else WARN("No DC! Prepare for trouble\n");
907 Main_DirectDrawSurface_GetDDInterface(LPDIRECTDRAWSURFACE7 iface, LPVOID* pDD)
909 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
911 TRACE("(%p)->(%p)\n",This,pDD);
912 *pDD = ICOM_INTERFACE(This->ddraw_owner, IDirectDraw7);
913 IDirectDraw7_AddRef(ICOM_INTERFACE(This->ddraw_owner, IDirectDraw7));
918 Main_DirectDrawSurface_GetFlipStatus(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags)
920 /* XXX: DDERR_INVALIDSURFACETYPE */
922 TRACE("(%p)->(%08lx)\n",iface,dwFlags);
926 case DDGFS_ISFLIPDONE:
930 return DDERR_INVALIDPARAMS;
935 Main_DirectDrawSurface_GetLOD(LPDIRECTDRAWSURFACE7 iface, LPDWORD pdwMaxLOD)
937 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
939 TRACE("(%p)->(%p)\n",This,pdwMaxLOD);
942 *pdwMaxLOD = This->max_lod;
947 Main_DirectDrawSurface_GetOverlayPosition(LPDIRECTDRAWSURFACE7 iface,
948 LPLONG pX, LPLONG pY)
950 return DDERR_NOTAOVERLAYSURFACE;
954 Main_DirectDrawSurface_GetPalette(LPDIRECTDRAWSURFACE7 iface,
955 LPDIRECTDRAWPALETTE* ppPalette)
957 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
959 TRACE("(%p)->(%p)\n",This,ppPalette);
960 if (This->palette == NULL)
961 return DDERR_NOPALETTEATTACHED;
963 *ppPalette = ICOM_INTERFACE(This->palette, IDirectDrawPalette);
964 IDirectDrawPalette_AddRef(ICOM_INTERFACE(This->palette,
965 IDirectDrawPalette));
970 Main_DirectDrawSurface_GetPixelFormat(LPDIRECTDRAWSURFACE7 iface,
971 LPDDPIXELFORMAT pDDPixelFormat)
973 /* What is DDERR_INVALIDSURFACETYPE for here? */
974 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
976 TRACE("(%p)->(%p)\n",This,pDDPixelFormat);
977 DD_STRUCT_COPY_BYSIZE(pDDPixelFormat,&This->surface_desc.u4.ddpfPixelFormat);
982 Main_DirectDrawSurface_GetPriority(LPDIRECTDRAWSURFACE7 iface,
985 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
987 TRACE("(%p)->(%p)\n",This,pdwPriority);
990 *pdwPriority = This->priority;
995 Main_DirectDrawSurface_GetPrivateData(LPDIRECTDRAWSURFACE7 iface,
996 REFGUID tag, LPVOID pBuffer,
997 LPDWORD pcbBufferSize)
999 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1002 TRACE("(%p)->(%p), size = %ld\n", This, pBuffer, *pcbBufferSize);
1004 data = find_private_data(This, tag);
1005 if (data == NULL) return DDERR_NOTFOUND;
1007 /* This may not be right. */
1008 if ((data->flags & DDSPD_VOLATILE)
1009 && data->uniqueness_value != This->uniqueness_value)
1010 return DDERR_EXPIRED;
1012 if (*pcbBufferSize < data->size)
1014 *pcbBufferSize = data->size;
1015 return DDERR_MOREDATA;
1018 if (data->flags & DDSPD_IUNKNOWNPTR)
1020 *(LPUNKNOWN *)pBuffer = data->ptr.object;
1021 IUnknown_AddRef(data->ptr.object);
1025 memcpy(pBuffer, data->ptr.data, data->size);
1032 Main_DirectDrawSurface_GetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface,
1033 LPDDSURFACEDESC2 pDDSD)
1035 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1037 TRACE("(%p)->(%p)\n",This,pDDSD);
1038 if ((pDDSD->dwSize < sizeof(DDSURFACEDESC)) ||
1039 (pDDSD->dwSize > sizeof(DDSURFACEDESC2))) {
1040 ERR("Impossible/Strange struct size %ld.\n",pDDSD->dwSize);
1041 return DDERR_GENERIC;
1044 DD_STRUCT_COPY_BYSIZE(pDDSD,&This->surface_desc);
1045 if (TRACE_ON(ddraw)) {
1046 DDRAW_dump_surface_desc(pDDSD);
1052 Main_DirectDrawSurface_GetUniquenessValue(LPDIRECTDRAWSURFACE7 iface,
1055 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1057 TRACE("(%p)->(%p)\n",This,pValue);
1058 *pValue = This->uniqueness_value;
1063 Main_DirectDrawSurface_Initialize(LPDIRECTDRAWSURFACE7 iface,
1064 LPDIRECTDRAW pDD, LPDDSURFACEDESC2 pDDSD)
1066 TRACE("(%p)->(%p,%p)\n",iface,pDD,pDDSD);
1067 return DDERR_ALREADYINITIALIZED;
1071 Main_DirectDrawSurface_IsLost(LPDIRECTDRAWSURFACE7 iface)
1073 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1075 TRACE("(%p) is%s lost\n",This, (This->lost ? "" : " not"));
1076 return This->lost ? DDERR_SURFACELOST : DD_OK;
1080 /* XXX This doesn't actually do any locking or keep track of the locked
1081 * rectangles. The behaviour is poorly documented. */
1083 Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
1084 LPDDSURFACEDESC2 pDDSD, DWORD flags, HANDLE h)
1086 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1088 if (TRACE_ON(ddraw)) {
1089 TRACE("(%p)->Lock(%p,%p,%08lx,%08lx)\n",This,prect,pDDSD,flags,(DWORD)h);
1090 TRACE(" - locking flags : "); DDRAW_dump_lockflag(flags);
1092 if (WARN_ON(ddraw)) {
1093 if (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY)) {
1094 WARN(" - unsupported locking flag : "); DDRAW_dump_lockflag(flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY));
1098 /* If the surface is already locked, return busy */
1100 WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n");
1101 return DDERR_SURFACEBUSY;
1104 /* First, copy the Surface description */
1105 DD_STRUCT_COPY_BYSIZE(pDDSD,&(This->surface_desc));
1107 /* Used to optimize the D3D Device locking */
1108 This->lastlocktype = flags & (DDLOCK_READONLY|DDLOCK_WRITEONLY);
1110 /* If asked only for a part, change the surface pointer.
1111 * (Not documented.) */
1112 if (prect != NULL) {
1113 TRACE(" lprect: %ldx%ld-%ldx%ld\n",
1114 prect->left,prect->top,prect->right,prect->bottom);
1115 /* First do some sanity checkings on the rectangle we receive.
1116 DungeonSiege seems to gives us once a very bad rectangle for example */
1117 if ((prect->top < 0) ||
1118 (prect->left < 0) ||
1119 (prect->bottom < 0) ||
1120 (prect->right < 0) ||
1121 (prect->left >= prect->right) ||
1122 (prect->top >= prect->bottom) ||
1123 (prect->left >= This->surface_desc.dwWidth) ||
1124 (prect->right > This->surface_desc.dwWidth) ||
1125 (prect->top >= This->surface_desc.dwHeight) ||
1126 (prect->bottom > This->surface_desc.dwHeight)) {
1127 ERR(" Invalid values in LPRECT !!!\n");
1128 return DDERR_INVALIDPARAMS;
1131 This->lock_update(This, prect, flags);
1133 if (pDDSD->u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) {
1135 switch(pDDSD->u4.ddpfPixelFormat.dwFourCC) {
1136 case MAKE_FOURCC('D','X','T','1') : blksize = 8; break;
1137 case MAKE_FOURCC('D','X','T','3') : blksize = 16; break;
1138 case MAKE_FOURCC('D','X','T','5') : blksize = 16; break;
1139 default: return DDERR_INVALIDPIXELFORMAT;
1141 pDDSD->lpSurface = (char *)This->surface_desc.lpSurface
1142 + prect->top/4 * (pDDSD->dwWidth+3)/4 * blksize
1143 + prect->left/4 * blksize;
1145 pDDSD->lpSurface = (char *)This->surface_desc.lpSurface
1146 + prect->top * This->surface_desc.u1.lPitch
1147 + prect->left * GET_BPP(This->surface_desc);
1149 This->lock_update(This, NULL, flags);
1152 This->locked = TRUE;
1154 TRACE("locked surface returning description : \n");
1155 if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(pDDSD);
1161 Main_DirectDrawSurface_PageLock(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags)
1163 /* Some surface types should return DDERR_CANTPAGELOCK. */
1168 Main_DirectDrawSurface_PageUnlock(LPDIRECTDRAWSURFACE7 iface, DWORD dwFlags)
1170 /* Some surface types should return DDERR_CANTPAGEUNLOCK, and we should
1171 * keep track so we can return DDERR_NOTPAGELOCKED as appropriate. */
1176 Main_DirectDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE7 iface, HDC hDC)
1179 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1181 TRACE("(%p)->(%p)\n",This,hDC);
1183 if (!This->dc_in_use || This->hDC != hDC)
1184 return DDERR_INVALIDPARAMS;
1186 This->release_dc(This, hDC);
1188 hr = IDirectDrawSurface7_Unlock(iface, NULL);
1189 if (FAILED(hr)) return hr;
1191 This->dc_in_use = FALSE;
1200 Main_DirectDrawSurface_SetClipper(LPDIRECTDRAWSURFACE7 iface,
1201 LPDIRECTDRAWCLIPPER pDDClipper)
1203 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1205 TRACE("(%p)->(%p)\n",This,pDDClipper);
1206 if (pDDClipper == ICOM_INTERFACE(This->clipper, IDirectDrawClipper))
1209 if (This->clipper != NULL)
1210 IDirectDrawClipper_Release(ICOM_INTERFACE(This->clipper,
1211 IDirectDrawClipper));
1213 This->clipper = ICOM_OBJECT(IDirectDrawClipperImpl, IDirectDrawClipper,
1215 if (pDDClipper != NULL)
1216 IDirectDrawClipper_AddRef(pDDClipper);
1222 Main_DirectDrawSurface_SetColorKey(LPDIRECTDRAWSURFACE7 iface,
1223 DWORD dwFlags, LPDDCOLORKEY pCKey)
1225 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1227 TRACE("(%p)->(%08lx,%p)\n",This,dwFlags,pCKey);
1229 if (TRACE_ON(ddraw)) {
1230 TRACE(" - colorkey flags : ");
1231 DDRAW_dump_colorkeyflag(dwFlags);
1234 if ((dwFlags & DDCKEY_COLORSPACE) != 0) {
1235 FIXME(" colorkey value not supported (%08lx) !\n", dwFlags);
1236 return DDERR_INVALIDPARAMS;
1239 /* TODO: investigate if this function can take multiple bits set at the same
1240 time (ie setting multiple colorkey values at the same time with only
1244 switch (dwFlags & ~DDCKEY_COLORSPACE) {
1245 case DDCKEY_DESTBLT:
1246 This->surface_desc.ddckCKDestBlt = *pCKey;
1247 This->surface_desc.dwFlags |= DDSD_CKDESTBLT;
1250 case DDCKEY_DESTOVERLAY:
1251 This->surface_desc.u3.ddckCKDestOverlay = *pCKey;
1252 This->surface_desc.dwFlags |= DDSD_CKDESTOVERLAY;
1255 case DDCKEY_SRCOVERLAY:
1256 This->surface_desc.ddckCKSrcOverlay = *pCKey;
1257 This->surface_desc.dwFlags |= DDSD_CKSRCOVERLAY;
1261 This->surface_desc.ddckCKSrcBlt = *pCKey;
1262 This->surface_desc.dwFlags |= DDSD_CKSRCBLT;
1266 return DDERR_INVALIDPARAMS;
1269 switch (dwFlags & ~DDCKEY_COLORSPACE) {
1270 case DDCKEY_DESTBLT:
1271 This->surface_desc.dwFlags &= ~DDSD_CKDESTBLT;
1274 case DDCKEY_DESTOVERLAY:
1275 This->surface_desc.dwFlags &= ~DDSD_CKDESTOVERLAY;
1278 case DDCKEY_SRCOVERLAY:
1279 This->surface_desc.dwFlags &= ~DDSD_CKSRCOVERLAY;
1283 This->surface_desc.dwFlags &= ~DDSD_CKSRCBLT;
1287 return DDERR_INVALIDPARAMS;
1291 if (This->aux_setcolorkey_cb) This->aux_setcolorkey_cb(This, dwFlags, pCKey);
1297 Main_DirectDrawSurface_SetLOD(LPDIRECTDRAWSURFACE7 iface, DWORD dwMaxLOD)
1299 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1301 TRACE("(%p)->(%08lx)\n",This,dwMaxLOD);
1302 CHECK_TEXTURE(This);
1304 This->max_lod = dwMaxLOD;
1309 Main_DirectDrawSurface_SetOverlayPosition(LPDIRECTDRAWSURFACE7 iface,
1312 return DDERR_NOTAOVERLAYSURFACE;
1316 Main_DirectDrawSurface_SetPalette(LPDIRECTDRAWSURFACE7 iface,
1317 LPDIRECTDRAWPALETTE pPalette)
1319 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1320 IDirectDrawPalette *pal_to_rel = NULL;
1322 TRACE("(%p)->(%p)\n",This,pPalette);
1323 if (pPalette == ICOM_INTERFACE(This->palette, IDirectDrawPalette))
1326 if (This->palette != NULL) {
1327 if (This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
1328 This->palette->global.dwFlags &= ~DDPCAPS_PRIMARYSURFACE;
1329 pal_to_rel = ICOM_INTERFACE(This->palette, IDirectDrawPalette);
1332 This->palette = ICOM_OBJECT(IDirectDrawPaletteImpl, IDirectDrawPalette,
1334 if (pPalette != NULL) {
1335 IDirectDrawPalette_AddRef(pPalette);
1336 if (This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
1337 This->palette->global.dwFlags |= DDPCAPS_PRIMARYSURFACE;
1340 This->set_palette(This, This->palette);
1342 /* Do the palette release at the end to prevent doing some 'loop' when removing
1343 * the surface maintaining the last reference on a palette.
1345 if (pal_to_rel != NULL)
1346 IDirectDrawPalette_Release(pal_to_rel);
1352 Main_DirectDrawSurface_SetPriority(LPDIRECTDRAWSURFACE7 iface,
1355 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1357 TRACE("(%p)->(%08lx)\n",This,dwPriority);
1358 CHECK_TEXTURE(This);
1360 This->priority = dwPriority;
1364 /* Be careful when locking this: it is risky to call the object's AddRef
1365 * or Release holding a lock. */
1367 Main_DirectDrawSurface_SetPrivateData(LPDIRECTDRAWSURFACE7 iface,
1368 REFGUID tag, LPVOID pData,
1369 DWORD cbSize, DWORD dwFlags)
1372 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1374 TRACE("(%p)->(%p), size=%ld\n", This, pData, cbSize);
1376 data = find_private_data(This, tag);
1379 data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data));
1380 if (data == NULL) return DDERR_OUTOFMEMORY;
1383 data->flags = dwFlags;
1384 data->uniqueness_value = This->uniqueness_value;
1386 if (dwFlags & DDSPD_IUNKNOWNPTR)
1388 data->ptr.object = (LPUNKNOWN)pData;
1389 data->size = sizeof(LPUNKNOWN);
1390 IUnknown_AddRef(data->ptr.object);
1394 data->ptr.data = HeapAlloc(GetProcessHeap(), 0, cbSize);
1395 if (data->ptr.data == NULL)
1397 HeapFree(GetProcessHeap(), 0, data);
1398 return DDERR_OUTOFMEMORY;
1401 data->size = cbSize;
1402 memcpy(data->ptr.data, pData, data->size);
1406 data->next = This->private_data;
1408 if (This->private_data)
1409 This->private_data->prev = data;
1410 This->private_data = data;
1416 /* I don't actually know how windows handles this case. The only
1417 * reason I don't just call FreePrivateData is because I want to
1418 * guarantee SetPrivateData working when using LPUNKNOWN or data
1419 * that is no larger than the old data. */
1421 FIXME("Replacing existing private data not implemented yet.\n");
1426 /* SetSurfaceDesc */
1429 Main_DirectDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface, LPRECT pRect)
1431 IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface;
1433 TRACE("(%p)->Unlock(%p)\n",This,pRect);
1435 if (!This->locked) {
1436 WARN("Surface not locked - returing DDERR_NOTLOCKED\n");
1437 return DDERR_NOTLOCKED;
1440 This->locked = FALSE;
1441 This->unlock_update(This, pRect);
1442 if (This->aux_unlock)
1443 This->aux_unlock(This->aux_ctx, This->aux_data, pRect);
1449 Main_DirectDrawSurface_UpdateOverlay(LPDIRECTDRAWSURFACE7 iface,
1451 LPDIRECTDRAWSURFACE7 pDstSurface,
1452 LPRECT pDstRect, DWORD dwFlags,
1455 return DDERR_UNSUPPORTED;
1458 /* MSDN: "not currently implemented." */
1460 Main_DirectDrawSurface_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE7 iface,
1463 return DDERR_UNSUPPORTED;
1467 Main_DirectDrawSurface_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE7 iface,
1469 LPDIRECTDRAWSURFACE7 pDDSRef)
1471 return DDERR_NOTAOVERLAYSURFACE;