Author: greatlrd
Date: Sat Nov 29 10:09:06 2008
New Revision: 37731
URL:
http://svn.reactos.org/svn/reactos?rev=37731&view=rev
Log:
Implement DdCanCreateSurface for wined3d
Modified:
branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c
Modified: branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/gdi32/…
==============================================================================
--- branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c [iso-8859-1] (original)
+++ branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c [iso-8859-1] Sat Nov 29
10:09:06 2008
@@ -332,21 +332,58 @@
WINAPI
DdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA CanCreateSurface)
{
- /* Fixme for opengl hel emulations */
- HEL_OGL_STUB;
-
-#if 0
- /*
- * Note : This functions are basic same, in win32k
- * NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface are mergs
- * toghter in win32k at end and retrurn same data, it is still sepreated
- * at user mode but in kmode it is not.
- */
-
- /* Call win32k */
- return NtGdiDdCanCreateSurface(GetDdHandle(CanCreateSurface->lpDD->hDD),
- (PDD_CANCREATESURFACEDATA)CanCreateSurface);
-#endif
+ DWORD i = 0;
+ if (CanCreateSurface->lpDDSurfaceDesc)
+ {
+
+ CanCreateSurface->ddRVal = DDERR_INVALIDPIXELFORMAT;
+
+ if ((CanCreateSurface->lpDDSurfaceDesc->dwSize == sizeof(DDSURFACEDESC) ||
+ CanCreateSurface->lpDDSurfaceDesc->dwSize == sizeof(DDSURFACEDESC2)))
+ {
+ if (CanCreateSurface->bIsDifferentPixelFormat == FALSE)
+ {
+ // Maybe more check before we return DD_OK
+ CanCreateSurface->ddRVal = DD_OK;
+ }
+ else
+ {
+ if (CanCreateSurface->lpDDSurfaceDesc->dwFlags & DDPF_FOURCC)
+ {
+
+ for (i=0;i<CanCreateSurface->lpDD->dwNumFourCC;i++)
+ {
+ if (CanCreateSurface->lpDD->lpdwFourCC[i] ==
CanCreateSurface->lpDDSurfaceDesc->ddpfPixelFormat.dwFourCC)
+ {
+ // calc yuvBitCount
+ switch (
CanCreateSurface->lpDDSurfaceDesc->ddpfPixelFormat.dwFourCC )
+ {
+ case
MAKEFOURCC('Y','U','Y','2') :
+
CanCreateSurface->lpDDSurfaceDesc->ddpfPixelFormat.dwYUVBitCount = 16;
+ break;
+
+ case
MAKEFOURCC('U','Y','V','Y') :
+
CanCreateSurface->lpDDSurfaceDesc->ddpfPixelFormat.dwYUVBitCount = 16;
+ break;
+
+ case
MAKEFOURCC('Y','V','1','2') :
+
CanCreateSurface->lpDDSurfaceDesc->ddpfPixelFormat.dwYUVBitCount = 12;
+ break;
+
+ default:
+ break;
+ }
+
+ // Maybe more check before we return DD_OK
+ CanCreateSurface->ddRVal = DD_OK;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ return DDHAL_DRIVER_HANDLED;
}
/*