ReactOS 0.4.15-dev-7928-g68a8619
surface_main.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS DirectX
4 * FILE: dll/directx/ddraw/Surface/surface_main.c
5 * PURPOSE: IDirectDrawSurface7 Implementation
6 * PROGRAMMER: Magnus Olsen, Maarten Bosma
7 *
8 */
9
10#include "rosdraw.h"
11
12
13/* FIXME adding hal and hel stub
14 DestroySurface;
15 SetClipList;
16 AddAttachedSurface;
17 GetFlipStatus;
18 SetOverlayPosition;
19 SetPalette;
20*/
21
24{
27 if (newThis)
28 {
29 newThis->lpLcl = This->lpLcl;
30 newThis->lpLink = This;
31 }
32 return newThis;
33}
34
36{
38}
39
41{
42
44
45 if (This!=NULL)
46 {
47 This->dwIntRefCnt++;
48 This->lpLcl->dwLocalRefCnt++;
49
50 if (This->lpLcl->lpGbl != NULL)
51 {
52 This->lpLcl->lpGbl->dwRefCnt++;
53 }
54 }
55 return This->dwIntRefCnt;
56
57}
58
61{
62 HRESULT retVal = DD_OK;
63 *ppObj = NULL;
64
66
68 {
69 if (IsEqualGUID(&IID_IDirectDrawSurface7, riid))
70 {
71 if (This->lpVtbl != &DirectDrawSurface7_Vtable)
72 {
74 if (!This)
75 {
78 }
79 }
81 *ppObj = This;
83 }
84 else if (IsEqualGUID(&IID_IDirectDrawSurface4, riid))
85 {
86 if (This->lpVtbl != &DirectDrawSurface4_Vtable)
87 {
89 if (!This)
90 {
93 }
94 }
96 *ppObj = This;
98 }
99 else if (IsEqualGUID(&IID_IDirectDrawSurface3, riid))
100 {
101 if (This->lpVtbl != &DirectDrawSurface3_Vtable)
102 {
104 if (!This)
105 {
106 retVal = DDERR_OUTOFVIDEOMEMORY;
108 }
109 }
111 *ppObj = This;
113 }
114 else if (IsEqualGUID(&IID_IDirectDrawSurface2, riid))
115 {
116 if (This->lpVtbl != &DirectDrawSurface2_Vtable)
117 {
119 if (!This)
120 {
121 retVal = DDERR_OUTOFVIDEOMEMORY;
123 }
124 }
126 *ppObj = This;
128 }
129 else if (IsEqualGUID(&IID_IDirectDrawSurface, riid))
130 {
131 if (This->lpVtbl != &DirectDrawSurface_Vtable)
132 {
134 if (!This)
135 {
136 retVal = DDERR_OUTOFVIDEOMEMORY;
138 }
139 }
141 *ppObj = This;
143 }
144 else if (IsEqualGUID(&IID_IDirectDrawColorControl, riid))
145 {
146 if (This->lpVtbl != &DirectDrawColorControl_Vtable)
147 {
149 if (!This)
150 {
151 retVal = DDERR_OUTOFVIDEOMEMORY;
153 }
154 }
156 *ppObj = This;
158 }
159 else if (IsEqualGUID(&IID_IDirectDrawGammaControl, riid))
160 {
161 if (This->lpVtbl != &DirectDrawGammaControl_Vtable)
162 {
164 if (!This)
165 {
166 retVal = DDERR_OUTOFVIDEOMEMORY;
168 }
169 }
171 *ppObj = This;
173 }
174 else if (IsEqualGUID(&IID_IDirectDrawSurfaceKernel, riid))
175 {
176 if (This->lpVtbl != &DirectDrawSurfaceKernel_Vtable)
177 {
179 if (!This)
180 {
181 retVal = DDERR_OUTOFVIDEOMEMORY;
183 }
184 }
186 *ppObj = This;
188 }
189 else if (IsEqualGUID(&IID_IDirect3D, riid))
190 {
191 if (This->lpVtbl != &IDirect3D_Vtbl)
192 {
194 if (!This)
195 {
196 retVal = DDERR_OUTOFVIDEOMEMORY;
198 }
199 }
200 This->lpVtbl = &IDirect3D_Vtbl;
201 *ppObj = This;
203 }
204 else if (IsEqualGUID(&IID_IDirect3D2, riid))
205 {
206 if (This->lpVtbl != &IDirect3D2_Vtbl)
207 {
209 if (!This)
210 {
211 retVal = DDERR_OUTOFVIDEOMEMORY;
213 }
214 }
215 This->lpVtbl = &IDirect3D2_Vtbl;
216 *ppObj = This;
218 }
219 else if (IsEqualGUID(&IID_IDirect3D3, riid))
220 {
221 if (This->lpVtbl != &IDirect3D3_Vtbl)
222 {
224 if (!This)
225 {
226 retVal = DDERR_OUTOFVIDEOMEMORY;
228 }
229 }
230 This->lpVtbl = &IDirect3D3_Vtbl;
231 *ppObj = This;
233 }
234 else if (IsEqualGUID(&IID_IDirect3D7, riid))
235 {
236 if (This->lpVtbl != &IDirect3D7_Vtbl)
237 {
239 if (!This)
240 {
241 retVal = DDERR_OUTOFVIDEOMEMORY;
243 }
244 }
245 This->lpVtbl = &IDirect3D7_Vtbl;
246 *ppObj = This;
248 }
249 else
250 {
251 DX_STUB_str("E_NOINTERFACE");
252 retVal = E_NOINTERFACE;
253 }
254 }
256 {
257 }
258 _SEH2_END;
259 return retVal;
260}
261
262
263
265{
266 /* FIXME
267 This is not right exiame how it should be done
268 */
269 ULONG ret = --This->dwIntRefCnt;
270 if(!ret)
271 {
272 DX_STUB_str("Release is a bit simplistic right now\n");
276 }
277 return ret;
278}
279
281{
283
284 if(ref == 0) Main_DirectDraw_Release(This->lpLcl->lpSurfMore->lpDD_int);
285
286 return ref;
287}
288
291{
293
295
296 if (ThisDest == NULL)
297 {
298 return DDERR_INVALIDPARAMS;
299 }
300
301 /* Zero out members in DDHAL_BLTDATA */
303 ZeroMemory(&mDdBlt.bltFX, sizeof(DDBLTFX));
304
305 /* Check if we got HAL support for this api */
306 if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
308 {
310 }
311 /* Check if we got HEL support for this api */
312 else if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HELDDSurface.dwFlags &
314 {
316 }
317
318 if (mDdBlt.Blt == NULL)
319 {
320 /* This API is unsupported */
321 return DDERR_UNSUPPORTED;
322 }
323
324 /* Prepare for draw, if we do not reset the DdResetVisrgn some graphics card will not draw on the screen */
325 if (!DdResetVisrgn( ThisDest->lpLcl->lpSurfMore->slist[0], NULL))
326 {
327 DX_STUB_str("DdResetVisrgn failed");
328 }
329
330 mDdBlt.lpDD = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl;
332 ThisDest->lpLcl->lpSurfMore->slist[0]->hDC = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->hDC;
333
334 /* Setup Src */
335 if (( ThisSrc != NULL ) )
336 {
337
339 ThisSrc->lpLcl->lpSurfMore->slist[0]->hDC = ThisSrc->lpLcl->lpSurfMore->lpDD_lcl->hDC;
340
341 if (rsrc != NULL)
342 {
343 memmove(&mDdBlt.rSrc, rsrc, sizeof (RECTL));
344 }
345 else
346 {
348 (RECT *)&mDdBlt.rSrc))
349 {
350 DX_STUB_str("GetWindowRect failed");
351 }
352 }
353
354 /* FIXME
355 * compare so we do not write too far
356 * ThisDest->lpLcl->lpGbl->wWidth; <- surface max width
357 * ThisDest->lpLcl->lpGbl->wHeight <- surface max height
358 * ThisDest->lpLcl->lpGbl->lPitch <- surface bpp
359 */
360
361 }
362
363 /* Setup dest */
364 if (rdst != NULL)
365 {
366 memmove(&mDdBlt.rDest, rdst, sizeof (RECTL));
367 }
368 else
369 {
370 if (!GetWindowRect((HWND)ThisDest->lpLcl->lpSurfMore->lpDD_lcl->hWnd,
371 (RECT *)&mDdBlt.rDest))
372 {
373 DX_STUB_str("GetWindowRect failed");
374 }
375 }
376
377 /* FIXME
378 * compare so we do not write too far
379 * ThisDest->lpLcl->lpGbl->wWidth; <- surface max width
380 * ThisDest->lpLcl->lpGbl->wHeight <- surface max height
381 * ThisDest->lpLcl->lpGbl->lPitch <- surface bpp
382 */
383
384
385 /* setup bltFX */
386 if (lpbltfx != NULL)
387 {
388 memmove(&mDdBlt.bltFX, lpbltfx, sizeof (DDBLTFX));
389 }
390
391 /* setup value that are not config yet */
394 mDdBlt.bltFX.dwSize = sizeof(DDBLTFX);
395
396
397 /* FIXME
398 BltData.dwRectCnt
399 BltData.dwROPFlags
400 BltData.IsClipped
401 BltData.prDestRects
402 BltData.rOrigDest
403 BltData.rOrigSrc
404 BltData.ddRVal
405 */
406
408 {
409 DX_STUB_str("mDdBlt DDHAL_DRIVER_HANDLED");
410 return DDERR_NOBLTHW;
411 }
412
413 return mDdBlt.ddRVal;
414}
415
416
420{
421 DDHAL_LOCKDATA mdLock;
422
424
425 DX_WINDBG_trace_res( (DWORD)ThisDest->lpLcl->lpGbl->wWidth, (DWORD)ThisDest->lpLcl->lpGbl->wHeight, (DWORD)ThisDest->lpLcl->lpGbl->lPitch, (DWORD) 0);
426
427 /* Zero out members in DDHAL_LOCKDATA */
428 ZeroMemory(&mdLock, sizeof(DDHAL_LOCKDATA));
429
430 /* Check if we got HAL support for this api */
431 if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
433 {
435 }
436 /* Check if we got HEL support for this api */
437 else if (( ThisDest->lpLcl->lpGbl->lpDD->lpDDCBtmp->HELDDSurface.dwFlags &
439 {
441 }
442
443 if (mdLock.Lock == NULL)
444 {
445 /* This api are unsupported */
446 return DDERR_UNSUPPORTED;
447 }
448
449 if (events != NULL)
450 {
451 return DDERR_INVALIDPARAMS;
452 }
453
454 /* FIXME add a check see if lock support or not */
455
456 if (prect!=NULL)
457 {
458 mdLock.bHasRect = TRUE;
459 memcpy(&mdLock.rArea,prect,sizeof(RECTL));
460 }
461 else
462 {
463 mdLock.bHasRect = FALSE;
464 }
465
466 //FIXME check if it primary or not and use primary or pixelformat data, at moment it is hardcode to primary
467
469 mdLock.dwFlags = flags;
470 mdLock.lpDDSurface = ThisDest->lpLcl->lpSurfMore->slist[0];
471 mdLock.lpDD = ThisDest->lpLcl->lpSurfMore->lpDD_lcl->lpGbl;
472 mdLock.lpSurfData = NULL;
473
474
475 if (!DdResetVisrgn(ThisDest->lpLcl->lpSurfMore->slist[0], NULL))
476 {
477 DX_STUB_str("Here DdResetVisrgn lock");
478 // return DDERR_UNSUPPORTED;
479 }
480
481 if (mdLock.Lock(&mdLock)!= DDHAL_DRIVER_HANDLED)
482 {
483 DX_STUB_str("Here DDHAL_DRIVER_HANDLED lock");
484 return DDERR_UNSUPPORTED;
485 }
486
487 // FIXME ??? is this right ??
488
489 if (pDDSD != NULL)
490 {
491 ZeroMemory(pDDSD,sizeof(DDSURFACEDESC2));
492 pDDSD->dwSize = sizeof(DDSURFACEDESC2);
493
494 //if (pDDSD->dwSize == sizeof(DDSURFACEDESC2))
495 //{
496 // ZeroMemory(pDDSD,sizeof(DDSURFACEDESC2));
497 // // FIXME the internal mddsdPrimary shall be DDSURFACEDESC2
498 // memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
499 // pDDSD->dwSize = sizeof(DDSURFACEDESC2);
500 //}
501 //if (pDDSD->dwSize == sizeof(DDSURFACEDESC))
502 //{
503 // RtlZeroMemory(pDDSD,sizeof(DDSURFACEDESC));
504 // memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
505 // pDDSD->dwSize = sizeof(DDSURFACEDESC);
506 //}
507
508
509 pDDSD->lpSurface = (LPVOID) mdLock.lpSurfData;
510
511 pDDSD->dwHeight = ThisDest->lpLcl->lpGbl->wHeight;
512 pDDSD->dwWidth = ThisDest->lpLcl->lpGbl->wWidth;
513
514 pDDSD->ddpfPixelFormat.dwRGBBitCount = ThisDest->lpLcl->lpGbl->lpDD->lpModeInfo->dwBPP;// .lpModeInfo->dwBPP; //This->lpLcl->lpGbl->lPitch/ 8;
515 pDDSD->lPitch = ThisDest->lpLcl->lpGbl->lPitch;
517 }
518
519 return mdLock.ddRVal;
520}
521
522
524{
525 DDHAL_UNLOCKDATA mdUnLock;
526
528
529 /* Zero out members in DDHAL_UNLOCKDATA */
530 ZeroMemory(&mdUnLock, sizeof(DDHAL_UNLOCKDATA));
531
532 /* Check if we got HAL support for this api */
533 if (( This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HALDDSurface.dwFlags &
535 {
536 mdUnLock.Unlock = This->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HALDDSurface.Unlock;
537 }
538 /* Check if we got HEL support for this api */
539 else if (( This->lpLcl->lpGbl->lpDD->lpDDCBtmp->HELDDSurface.dwFlags &
541 {
542 mdUnLock.Unlock = This->lpLcl->lpSurfMore->lpDD_lcl->lpGbl->lpDDCBtmp->HELDDSurface.Unlock;
543 }
544
545 if (mdUnLock.Unlock == NULL)
546 {
547 /* This api are unsupported */
548 return DDERR_UNSUPPORTED;
549 }
550
551 mdUnLock.ddRVal = DDERR_NOTPALETTIZED;
552 mdUnLock.lpDD = This->lpLcl->lpSurfMore->lpDD_lcl->lpGbl;
553 mdUnLock.lpDDSurface = This->lpLcl->lpSurfMore->slist[0];
554
555 if (!DdResetVisrgn( mdUnLock.lpDDSurface, NULL))
556 {
557 DX_STUB_str("DdResetVisrgn fail");
558 //return DDERR_UNSUPPORTED; /* this can fail */
559 }
560
561 if (mdUnLock.Unlock(&mdUnLock)!= DDHAL_DRIVER_HANDLED)
562 {
563 DX_STUB_str("unLock fail");
564 return DDERR_UNSUPPORTED;
565 }
566
567 return mdUnLock.ddRVal;
568}
569
573{
574
575 // LPDDRAWI_DDRAWSURFACE_INT This = (LPDDRAWI_DDRAWSURFACE_INT)iface;
576 // LPDDRAWI_DDRAWSURFACE_INT That = (LPDDRAWI_DDRAWSURFACE_INT)pAttach;
577
579
580 DX_STUB;
581}
582
585 LPDDSCAPS2 pCaps,
586 LPDDRAWI_DDRAWSURFACE_INT* ppSurface)
587{
588 /* FIXME hacked */
589
590
592
593 *ppSurface = This->lpLcl->lpGbl->lpDD->dsList;
594
595
596 return DD_OK;
597}
598
601{
602
604
605 if (!(This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_FLIP))
606 {
607 return DDERR_GENERIC;
608 }
609
610 DX_STUB;
611}
612
615{
616
618
619 if (This == NULL)
620 {
621 return DDERR_INVALIDOBJECT;
622 }
623
624 if (pCaps == NULL)
625 {
626 return DDERR_INVALIDPARAMS;
627 }
628
629 RtlZeroMemory(pCaps,sizeof(DDSCAPS2));
630
631 pCaps->dwCaps = This->lpLcl->ddsCaps.dwCaps;
632
633 return DD_OK;
634}
635
638 LPDIRECTDRAWCLIPPER* ppClipper)
639{
640
642
643 if (This == NULL)
644 {
645 return DDERR_INVALIDOBJECT;
646 }
647
648 if (ppClipper == NULL)
649 {
650 return DDERR_INVALIDPARAMS;
651 }
652
653 if (This->lpLcl->lp16DDClipper == NULL)
654 {
656 }
657
658 *ppClipper = (LPDIRECTDRAWCLIPPER)This->lpLcl->lp16DDClipper;
659
660 return DD_OK;
661}
662
665 LPDIRECTDRAWCLIPPER pDDClipper)
666{
667
669
670 if (This == NULL)
671 {
672 return DDERR_INVALIDOBJECT;
673 }
674
675 if(pDDClipper == NULL)
676 {
677 if(!This->lpLcl->lp16DDClipper)
679
680 DirectDrawClipper_Release((LPDIRECTDRAWCLIPPER)This->lpLcl->lp16DDClipper);
681 This->lpLcl->lp16DDClipper = NULL;
682 return DD_OK;
683 }
684
685 // FIXME: Check Surface type and return DDERR_INVALIDSURFACETYPE
686
688 This->lpLcl->lp16DDClipper = (LPDDRAWI_DDRAWCLIPPER_INT)pDDClipper;
689
690 return DD_OK;
691}
692
695{
696
698
699 if (This == NULL)
700 {
701 return DDERR_INVALIDOBJECT;
702 }
703
704 if (phDC == NULL)
705 {
706 return DDERR_INVALIDPARAMS;
707 }
708
709
710 *phDC = (HDC)This->lpLcl->lpSurfMore->lpDD_lcl->hDC;
711
712 return DD_OK;
713}
714
717 LPDDPIXELFORMAT pDDPixelFormat)
718{
720
722
723 if (pDDPixelFormat != NULL)
724 {
725 if (This->lpLcl->dwFlags & DDRAWISURF_HASPIXELFORMAT)
726 {
727 memcpy(pDDPixelFormat,&This->lpLcl->lpGbl->ddpfSurface,sizeof(DDPIXELFORMAT));
728 }
729 else
730 {
731 memcpy(pDDPixelFormat,&This->lpLcl->lpSurfMore->
732 lpDD_lcl->lpGbl->vmiData.ddpfDisplay,sizeof(DDPIXELFORMAT));
733 }
734 retVale = DD_OK;
735 }
736
737 return retVale;
738}
739
742 LPDDSURFACEDESC2 pDDSD)
743{
745
747
748 dwSize = pDDSD->dwSize;
749
750 if ((dwSize != sizeof(DDSURFACEDESC)) &&
751 (dwSize != sizeof(DDSURFACEDESC2)))
752 {
753 return DDERR_GENERIC;
754 }
755
756 ZeroMemory(pDDSD,dwSize);
757
758 if (dwSize == sizeof(DDSURFACEDESC))
759 {
760 LPDDSURFACEDESC lpDS = (LPDDSURFACEDESC) pDDSD;
761 memcpy(&lpDS->ddckCKDestBlt, &This->lpLcl->ddckCKDestBlt, sizeof(DDCOLORKEY));
762 memcpy(&lpDS->ddckCKDestOverlay, &This->lpLcl->ddckCKDestOverlay, sizeof(DDCOLORKEY));
763 memcpy(&lpDS->ddckCKSrcBlt, &This->lpLcl->ddckCKSrcBlt, sizeof(DDCOLORKEY));
764 memcpy(&lpDS->ddckCKSrcOverlay, &This->lpLcl->ddckCKSrcOverlay, sizeof(DDCOLORKEY));
765 memcpy(&lpDS->ddpfPixelFormat, &This->lpLcl->lpGbl->ddpfSurface, sizeof(DDPIXELFORMAT));
766 memcpy(&lpDS->ddsCaps, &This->lpLcl->ddsCaps, sizeof(DDSCAPS));
767
768 lpDS->dwAlphaBitDepth = This->lpLcl->dwAlpha;
769 lpDS->dwBackBufferCount = This->lpLcl->dwBackBufferCount;
770
771 /* FIXME setting the flags right */
772 // lpDS->dwFlags = This->lpLcl->dwFlags;
773
774 lpDS->dwHeight = This->lpLcl->lpGbl->wHeight;
775 lpDS->dwWidth = This->lpLcl->lpGbl->wWidth;
776
777 /* This two are a union in lpDS and in This->lpLcl->lpGbl
778 so I comment out lPitch
779 lpDS->lPitch = This->lpLcl->lpGbl->lPitch;
780 */
781 lpDS->dwLinearSize = This->lpLcl->lpGbl->dwLinearSize;
782
783
784 /* This tree are a union */
785 //lpDS->dwMipMapCount
786 //lpDS->dwRefreshRate
787 //lpDS->dwZBufferBitDepth
788
789 /* Unknown */
790 // lpDS->dwReserved
791 // lpDS->lpSurface
792 }
793 else
794 {
795 memcpy(&pDDSD->ddckCKDestBlt, &This->lpLcl->ddckCKDestBlt, sizeof(DDCOLORKEY));
796
797 /*
798 pDDSD->dwEmptyFaceColor is a union to ddckCKDestOverlay
799 */
800 memcpy(&pDDSD->ddckCKDestOverlay, &This->lpLcl->ddckCKDestOverlay, sizeof(DDCOLORKEY));
801 memcpy(&pDDSD->ddckCKSrcBlt, &This->lpLcl->ddckCKSrcBlt, sizeof(DDCOLORKEY));
802 memcpy(&pDDSD->ddckCKSrcOverlay, &This->lpLcl->ddckCKSrcOverlay, sizeof(DDCOLORKEY));
803
804 /*
805 pDDSD->dwFVF is a union to ddpfPixelFormat
806 */
807 memcpy(&pDDSD->ddpfPixelFormat, &This->lpLcl->lpGbl->ddpfSurface, sizeof(DDPIXELFORMAT));
808 memcpy(&pDDSD->ddsCaps, &This->lpLcl->ddsCaps, sizeof(DDSCAPS));
809
810
811 pDDSD->dwAlphaBitDepth = This->lpLcl->dwAlpha;
812 pDDSD->dwBackBufferCount = This->lpLcl->dwBackBufferCount;
813
814 /* FIXME setting the flags right */
815 // lpDS->dwFlags = This->lpLcl->dwFlags;
816
817 pDDSD->dwHeight = This->lpLcl->lpGbl->wHeight;
818 pDDSD->dwWidth = This->lpLcl->lpGbl->wWidth;
819
820 /* This two are a union in lpDS and in This->lpLcl->lpGbl
821 so I comment out lPitch
822 lpDS->lPitch = This->lpLcl->lpGbl->lPitch;
823 */
824 pDDSD->dwLinearSize = This->lpLcl->lpGbl->dwLinearSize;
825
826 /* This tree are a union */
827 // pDDSD->dwMipMapCount
828 // pDDSD->dwRefreshRate
829 // pDDSD->dwSrcVBHandle
830
831 /* Unknown */
832 // lpDS->dwReserved
833 // lpDS->lpSurface
834 // pDDSD->dwTextureStage
835 }
836
837 return DD_OK;
838}
839
842{
844
845 if (This == NULL)
846 {
847 return DDERR_INVALIDOBJECT;
848 }
849
850 if (hDC == NULL)
851 {
852 return DDERR_INVALIDPARAMS;
853 }
854
855 /* FIXME check if surface exits or not */
856
857
858 if ((HDC)This->lpLcl->hDC == NULL)
859 {
860 return DDERR_GENERIC;
861 }
862
863 return DD_OK;
864}
865
869{
870
871 DDHAL_SETCOLORKEYDATA ColorKeyData;
872
874
875 ColorKeyData.ddRVal = DDERR_COLORKEYNOTSET;
876
877 if (This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_SETCOLORKEY)
878 {
879
880 ColorKeyData.lpDD = This->lpLcl->lpGbl->lpDD;
881 ColorKeyData.SetColorKey = This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.SetColorKey;
882
883 //ColorKeyData.lpDDSurface = &This->lpLcl->hDDSurface;
884 ColorKeyData.dwFlags = dwFlags;
885 /* FIXME
886 ColorKeyData.ckNew = ?
887 add / move dwFlags to This->lpLcl->dwFlags ??
888 */
889
890 if (ColorKeyData.SetColorKey(&ColorKeyData) == DDHAL_DRIVER_HANDLED )
891 {
892 return ColorKeyData.ddRVal;
893 }
894 }
896}
897
898
899
902{
903
904 DDHAL_SETOVERLAYPOSITIONDATA OverLayPositionData;
905
907
908 OverLayPositionData.ddRVal = DDERR_COLORKEYNOTSET;
909
910 if (This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.dwFlags & DDHAL_SURFCB32_SETOVERLAYPOSITION)
911 {
912
913 OverLayPositionData.lpDD = This->lpLcl->lpGbl->lpDD;
914 OverLayPositionData.SetOverlayPosition = This->lpLcl->lpGbl->lpDD->lpDDCBtmp->cbDDSurfaceCallbacks.SetOverlayPosition;
915
916 //OverLayPositionData.lpDDSrcSurface = This->lpLcl->lpSurfaceOverlaying->lpLcl->hDDSurface;
917 //OverLayPositionData.lpDDDestSurface = This->lpLcl->hDDSurface;
918
919 OverLayPositionData.lXPos = X;
920 OverLayPositionData.lYPos = Y;
921
922
923 /* FIXME
924 Should X and Y be save ??
925 */
926
927 if (OverLayPositionData.SetOverlayPosition(&OverLayPositionData) == DDHAL_DRIVER_HANDLED )
928 {
929 return OverLayPositionData.ddRVal;
930 }
931 }
932
933 return DDERR_GENERIC;
934}
static HDC hDC
Definition: 3dtext.c:33
ULONG WINAPI DirectDrawClipper_AddRef(LPDIRECTDRAWCLIPPER)
Definition: clipper_main.c:75
ULONG WINAPI DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER)
Definition: clipper_main.c:54
IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable
Definition: color_stubs.c:58
#define DdResetVisrgn
Definition: ddrawgdi.h:29
#define DDHAL_DRIVER_HANDLED
Definition: ddrawi.h:321
struct _DDRAWI_DDRAWCLIPPER_INT * LPDDRAWI_DDRAWCLIPPER_INT
Definition: ddrawi.h:145
#define DDHAL_SURFCB32_BLT
Definition: ddrawi.h:679
#define DDHAL_SURFCB32_LOCK
Definition: ddrawi.h:677
#define DDHAL_SURFCB32_UNLOCK
Definition: ddrawi.h:678
#define DDHAL_SURFCB32_SETOVERLAYPOSITION
Definition: ddrawi.h:685
#define DDHAL_SURFCB32_SETCOLORKEY
Definition: ddrawi.h:680
#define DDHAL_SURFCB32_FLIP
Definition: ddrawi.h:675
#define DDRAWISURF_HASPIXELFORMAT
Definition: ddrawi.h:1515
void * LPDDSURFACEDESC
Definition: ddstream.idl:23
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ULONG WINAPI Main_DirectDraw_Release(LPDDRAWI_DIRECTDRAW_INT This)
Definition: ddraw_main.c:194
VOID WINAPI AcquireDDThreadLock()
Definition: main.c:412
VOID WINAPI ReleaseDDThreadLock()
Definition: main.c:421
#define Y(I)
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define _SEH2_LEAVE
Definition: filesup.c:20
unsigned long DWORD
Definition: ntddk_ex.h:95
IDirectDrawGammaControlVtbl DirectDrawGammaControl_Vtable
Definition: gamma_stubs.c:60
GLbitfield flags
Definition: glext.h:7161
#define X(b, s)
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
REFIID riid
Definition: atlbase.h:39
IDirectDrawSurfaceKernelVtbl DirectDrawSurfaceKernel_Vtable
Definition: kernel_stubs.c:123
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
DDHAL_BLTDATA mDdBlt
Definition: main.c:47
HANDLE events[2]
Definition: event.c:4
static HDC
Definition: imagelist.c:92
#define LPVOID
Definition: nt_native.h:45
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define DX_STUB_str(x)
Definition: rosdraw.h:254
IDirectDrawSurfaceVtbl DirectDrawSurface_Vtable
IDirect3DVtbl IDirect3D_Vtbl
IDirectDrawSurface3Vtbl DirectDrawSurface3_Vtable
#define DxHeapMemAlloc(p, m)
Definition: rosdraw.h:113
IDirect3D7Vtbl IDirect3D7_Vtbl
IDirectDrawSurface4Vtbl DirectDrawSurface4_Vtable
IDirect3D3Vtbl IDirect3D3_Vtbl
IDirect3D2Vtbl IDirect3D2_Vtbl
#define DX_STUB
Definition: rosdraw.h:224
IDirectDrawSurface2Vtbl DirectDrawSurface2_Vtable
#define DX_WINDBG_trace_res(width, height, bpp, freq)
Definition: rosdraw.h:273
IDirectDrawSurface7Vtbl DirectDrawSurface7_Vtable
#define DxHeapMemFree(p)
Definition: rosdraw.h:120
#define DX_WINDBG_trace()
Definition: rosdraw.h:262
#define DDSD_WIDTH
Definition: ddraw.h:210
#define DDSD_PITCH
Definition: ddraw.h:211
struct IDirectDrawClipper * LPDIRECTDRAWCLIPPER
Definition: ddraw.h:721
struct _DDSURFACEDESC2 DDSURFACEDESC2
struct _DDBLTFX DDBLTFX
#define DDSD_HEIGHT
Definition: ddraw.h:209
#define DDERR_INVALIDOBJECT
Definition: ddraw.h:78
struct IDirectDraw * LPDIRECTDRAW
Definition: ddraw.h:710
#define DDERR_OUTOFVIDEOMEMORY
Definition: ddraw.h:112
#define DD_OK
Definition: ddraw.h:186
#define DDERR_COLORKEYNOTSET
Definition: ddraw.h:116
#define DDERR_UNSUPPORTED
Definition: ddraw.h:127
#define DDERR_GENERIC
Definition: ddraw.h:72
#define DDERR_NOCLIPPERATTACHED
Definition: ddraw.h:142
#define DDERR_NOTPALETTIZED
Definition: ddraw.h:163
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:79
#define DDERR_CANTLOCKSURFACE
Definition: ddraw.h:120
#define DDERR_ALREADYINITIALIZED
Definition: ddraw.h:67
#define DDERR_NOBLTHW
Definition: ddraw.h:149
DWORD dwSize
Definition: ddraw.h:1272
DWORD dwBPP
Definition: ddrawi.h:174
LPDDRAWI_DDRAWSURFACE_LCL lpDDSrcSurface
Definition: ddrawi.h:849
RECTL rSrc
Definition: ddrawi.h:850
LPDDRAWI_DIRECTDRAW_GBL lpDD
Definition: ddrawi.h:846
DDBLTFX bltFX
Definition: ddrawi.h:853
DWORD dwFlags
Definition: ddrawi.h:851
HRESULT ddRVal
Definition: ddrawi.h:854
LPDDRAWI_DDRAWSURFACE_LCL lpDDDestSurface
Definition: ddrawi.h:847
RECTL rDest
Definition: ddrawi.h:848
BOOL IsClipped
Definition: ddrawi.h:856
LPDDHALSURFCB_BLT Blt
Definition: ddrawi.h:855
DDHAL_DDSURFACECALLBACKS HALDDSurface
Definition: ddrawi.h:736
DDHAL_DDSURFACECALLBACKS HELDDSurface
Definition: ddrawi.h:739
LPDDHALSURFCB_LOCK Lock
Definition: ddrawi.h:396
LPDDHALSURFCB_BLT Blt
Definition: ddrawi.h:398
RECTL rArea
Definition: ddrawi.h:831
DWORD bHasRect
Definition: ddrawi.h:830
DWORD dwFlags
Definition: ddrawi.h:835
HRESULT ddRVal
Definition: ddrawi.h:833
LPDDRAWI_DIRECTDRAW_GBL lpDD
Definition: ddrawi.h:828
LPDDHALSURFCB_LOCK Lock
Definition: ddrawi.h:834
LPVOID lpSurfData
Definition: ddrawi.h:832
LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface
Definition: ddrawi.h:829
LPDDHALSURFCB_SETCOLORKEY SetColorKey
Definition: ddrawi.h:1855
LPDDRAWI_DIRECTDRAW_GBL lpDD
Definition: ddrawi.h:1850
LPDDHALSURFCB_SETOVERLAYPOSITION SetOverlayPosition
Definition: ddrawi.h:1865
LPDDRAWI_DIRECTDRAW_GBL lpDD
Definition: ddrawi.h:1859
LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface
Definition: ddrawi.h:840
LPDDHALSURFCB_UNLOCK Unlock
Definition: ddrawi.h:842
HRESULT ddRVal
Definition: ddrawi.h:841
LPDDRAWI_DIRECTDRAW_GBL lpDD
Definition: ddrawi.h:839
DWORD dwRGBBitCount
Definition: ddraw.h:1075
LPDDRAWI_DIRECTDRAW_GBL lpDD
Definition: ddrawi.h:1346
LPDDRAWI_DDRAWSURFACE_INT lpLink
Definition: ddrawi.h:1329
LPDDRAWI_DDRAWSURFACE_LCL lpLcl
Definition: ddrawi.h:1328
LPDDRAWI_DDRAWSURFACE_GBL lpGbl
Definition: ddrawi.h:1468
LPDDRAWI_DDRAWSURFACE_MORE lpSurfMore
Definition: ddrawi.h:1467
LPDDRAWI_DDRAWSURFACE_LCL * slist
Definition: ddrawi.h:1461
LPDDRAWI_DIRECTDRAW_LCL lpDD_lcl
Definition: ddrawi.h:1431
LPDDHALMODEINFO lpModeInfo
Definition: ddrawi.h:1244
LPDDHAL_CALLBACKS lpDDCBtmp
Definition: ddrawi.h:1224
LPDDRAWI_DIRECTDRAW_GBL lpGbl
Definition: ddrawi.h:1155
DWORD dwCaps
Definition: ddraw.h:732
DWORD dwWidth
Definition: ddraw.h:1155
DWORD dwHeight
Definition: ddraw.h:1154
DDSCAPS2 ddsCaps
Definition: ddraw.h:1188
DDPIXELFORMAT ddpfPixelFormat
Definition: ddraw.h:1185
DWORD dwBackBufferCount
Definition: ddraw.h:1163
DWORD dwLinearSize
Definition: ddraw.h:1159
DDCOLORKEY ddckCKDestOverlay
Definition: ddraw.h:1177
DWORD dwAlphaBitDepth
Definition: ddraw.h:1172
DDCOLORKEY ddckCKSrcOverlay
Definition: ddraw.h:1181
DDCOLORKEY ddckCKDestBlt
Definition: ddraw.h:1180
DWORD dwFlags
Definition: ddraw.h:1153
DDCOLORKEY ddckCKSrcBlt
Definition: ddraw.h:1182
LPVOID lpSurface
Definition: ddraw.h:1174
DWORD dwSize
Definition: ddraw.h:1152
Definition: send.c:48
LPDDRAWI_DDRAWSURFACE_INT internal_directdrawsurface_int_alloc(LPDDRAWI_DDRAWSURFACE_INT This)
Definition: surface_main.c:23
HRESULT WINAPI Main_DDrawSurface_Unlock(LPDDRAWI_DDRAWSURFACE_INT This, LPRECT pRect)
Definition: surface_main.c:523
ULONG WINAPI Main_DDrawSurface_Release4(LPDDRAWI_DDRAWSURFACE_INT This)
Definition: surface_main.c:280
HRESULT WINAPI Main_DDrawSurface_Initialize(LPDDRAWI_DDRAWSURFACE_INT iface, LPDIRECTDRAW pDD, LPDDSURFACEDESC2 pDDSD2)
Definition: surface_main.c:35
ULONG WINAPI Main_DDrawSurface_AddRef(LPDDRAWI_DDRAWSURFACE_INT This)
Definition: surface_main.c:40
ULONG WINAPI Main_DDrawSurface_Release(LPDDRAWI_DDRAWSURFACE_INT This)
Definition: surface_main.c:264
HRESULT WINAPI Main_DDrawSurface_SetOverlayPosition(LPDDRAWI_DDRAWSURFACE_INT This, LONG X, LONG Y)
Definition: surface_main.c:901
HRESULT WINAPI Main_DDrawSurface_GetAttachedSurface(LPDDRAWI_DDRAWSURFACE_INT This, LPDDSCAPS2 pCaps, LPDDRAWI_DDRAWSURFACE_INT *ppSurface)
Definition: surface_main.c:584
HRESULT WINAPI Main_DDrawSurface_Lock(LPDDRAWI_DDRAWSURFACE_INT ThisDest, LPRECT prect, LPDDSURFACEDESC2 pDDSD, DWORD flags, HANDLE events)
Definition: surface_main.c:418
HRESULT WINAPI Main_DDrawSurface_ReleaseDC(LPDDRAWI_DDRAWSURFACE_INT This, HDC hDC)
Definition: surface_main.c:841
HRESULT WINAPI Main_DDrawSurface_SetColorKey(LPDDRAWI_DDRAWSURFACE_INT This, DWORD dwFlags, LPDDCOLORKEY pCKey)
Definition: surface_main.c:867
HRESULT WINAPI Main_DDrawSurface_SetClipper(LPDDRAWI_DDRAWSURFACE_INT This, LPDIRECTDRAWCLIPPER pDDClipper)
Definition: surface_main.c:664
HRESULT WINAPI Main_DDrawSurface_QueryInterface(LPDDRAWI_DDRAWSURFACE_INT This, REFIID riid, LPVOID *ppObj)
Definition: surface_main.c:60
HRESULT WINAPI Main_DDrawSurface_GetPixelFormat(LPDDRAWI_DDRAWSURFACE_INT This, LPDDPIXELFORMAT pDDPixelFormat)
Definition: surface_main.c:716
HRESULT WINAPI Main_DDrawSurface_GetSurfaceDesc(LPDDRAWI_DDRAWSURFACE_INT This, LPDDSURFACEDESC2 pDDSD)
Definition: surface_main.c:741
HRESULT WINAPI Main_DDrawSurface_GetClipper(LPDDRAWI_DDRAWSURFACE_INT This, LPDIRECTDRAWCLIPPER *ppClipper)
Definition: surface_main.c:637
HRESULT WINAPI Main_DDrawSurface_GetCaps(LPDDRAWI_DDRAWSURFACE_INT This, LPDDSCAPS2 pCaps)
Definition: surface_main.c:614
HRESULT WINAPI Main_DDrawSurface_AddAttachedSurface(LPDDRAWI_DDRAWSURFACE_INT iface, LPDDRAWI_DDRAWSURFACE_INT pAttach)
Definition: surface_main.c:571
HRESULT WINAPI Main_DDrawSurface_GetDC(LPDDRAWI_DDRAWSURFACE_INT This, HDC *phDC)
Definition: surface_main.c:694
HRESULT WINAPI Main_DDrawSurface_GetBltStatus(LPDDRAWI_DDRAWSURFACE_INT This, DWORD dwFlags)
Definition: surface_main.c:600
HRESULT WINAPI Main_DDrawSurface_Blt(LPDDRAWI_DDRAWSURFACE_INT ThisDest, LPRECT rdst, LPDDRAWI_DDRAWSURFACE_INT ThisSrc, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
Definition: surface_main.c:289
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define ZeroMemory
Definition: winbase.h:1712
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList