From b14f99cc4667523b42ad9cdf134d07de390e262f Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sun, 7 Aug 2005 12:54:41 +0000 Subject: [PATCH] Implement Gdintry4 (not tested, we can not test it yet in ros, until we got ddraw.dll and some api in win32k/ntdraw been implement) svn path=/trunk/; revision=17164 --- reactos/lib/gdi32/include/precomp.h | 4 ++ reactos/lib/gdi32/misc/gdientry.c | 79 ++++++++++++++++++++++++++++- reactos/lib/gdi32/misc/stubs.c | 18 ------- 3 files changed, 81 insertions(+), 20 deletions(-) diff --git a/reactos/lib/gdi32/include/precomp.h b/reactos/lib/gdi32/include/precomp.h index 0e36b904871..092b9439f19 100644 --- a/reactos/lib/gdi32/include/precomp.h +++ b/reactos/lib/gdi32/include/precomp.h @@ -88,4 +88,8 @@ LogFontA2W(LPLOGFONTW pW, CONST LOGFONTA *pA); VOID STDCALL LogFontW2A(LPLOGFONTA pA, CONST LOGFONTW *pW); + +/* == Directx FUNCTIONS ================================================== */ +BOOL +intDDCreateSurface ( LPDDRAWI_DDRAWSURFACE_LCL pSurface, BOOL bComplete); /* EOF */ diff --git a/reactos/lib/gdi32/misc/gdientry.c b/reactos/lib/gdi32/misc/gdientry.c index 12a58b3c474..51f7dc6c07c 100644 --- a/reactos/lib/gdi32/misc/gdientry.c +++ b/reactos/lib/gdi32/misc/gdientry.c @@ -118,8 +118,18 @@ DdDeleteDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal) return NtGdiDdDeleteDirectDrawObject((HANDLE)pDirectDrawGlobal->hDD); } - - +/* + * @implemented + * + * GDIEntry 4 + */ +BOOL STDCALL DdCreateSurfaceObject( +LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal, +BOOL bPrimarySurface +) +{ + return intDDCreateSurface(pSurfaceLocal,1); +} /* * @implemented @@ -295,3 +305,68 @@ LPDDRAWI_DDRAWSURFACE_LCL pDDSLcl2 return TRUE; } + +/* interal create surface */ +BOOL +intDDCreateSurface ( LPDDRAWI_DDRAWSURFACE_LCL pSurface, + BOOL bComplete) +{ + DD_SURFACE_LOCAL SurfaceLocal; + DD_SURFACE_GLOBAL SurfaceGlobal; + DD_SURFACE_MORE SurfaceMore; + + /* Zero struct */ + RtlZeroMemory(&SurfaceLocal, sizeof(DD_SURFACE_LOCAL)); + RtlZeroMemory(&SurfaceGlobal, sizeof(DD_SURFACE_GLOBAL)); + RtlZeroMemory(&SurfaceMore, sizeof(DD_SURFACE_MORE)); + + /* Set up SurfaceLocal struct */ + SurfaceLocal.ddsCaps.dwCaps = pSurface->ddsCaps.dwCaps; + SurfaceLocal.dwFlags = pSurface->dwFlags; + + /* Set up SurfaceMore struct */ + /* copy pSurface->ddckCKDestBlt and pSurface->ddckCKSrcBlt to SurfaceMore.ddsCapsEx */ + memcpy(&SurfaceMore.ddsCapsEx, &pSurface->ddckCKDestBlt, sizeof(DDSCAPSEX)); + SurfaceMore.dwSurfaceHandle = (DWORD) pSurface->dbnOverlayNode.object_int->lpVtbl; + + + /* Set up SurfaceGlobal struct */ + SurfaceGlobal.fpVidMem = pSurface->lpGbl->fpVidMem; + SurfaceGlobal.dwLinearSize = pSurface->lpGbl->dwLinearSize; + SurfaceGlobal.wHeight = pSurface->lpGbl->wHeight; + SurfaceGlobal.wWidth = pSurface->lpGbl->wWidth; + + /* check which memory type should be use */ + if ((pSurface->dwFlags & DDRAWISURFGBL_LOCKVRAMSTYLE) == DDRAWISURFGBL_LOCKVRAMSTYLE) + { + memcpy(&SurfaceGlobal.ddpfSurface,&pSurface->lpGbl->lpDD->vmiData.ddpfDisplay, sizeof(DDPIXELFORMAT)); + } + else + { + memcpy(&SurfaceGlobal.ddpfSurface,&pSurface->lpGbl->ddpfSurface, sizeof(DDPIXELFORMAT)); + } + + /* Determer if Gdi32 chace of directdraw handler or not */ + if (pSurface->lpGbl->lpDD->hDD) + { + pSurface->hDDSurface = ((DWORD) NtGdiDdCreateSurfaceObject( (HANDLE) pSurface->lpGbl->lpDD->hDD, + (HANDLE) pSurface->hDDSurface, &SurfaceLocal, + &SurfaceMore, &SurfaceGlobal, bComplete)); + } + else + { + pSurface->hDDSurface = ((DWORD) NtGdiDdCreateSurfaceObject( (HANDLE) pDirectDrawGlobalInternal->hDD, + (HANDLE) pSurface->hDDSurface, &SurfaceLocal, + &SurfaceMore, + &SurfaceGlobal, + bComplete)); + } + + /* return status */ + if (pSurface->hDDSurface) + { + return TRUE; + } + + return FALSE; +} diff --git a/reactos/lib/gdi32/misc/stubs.c b/reactos/lib/gdi32/misc/stubs.c index da33b8ddfac..34c7a92e5e9 100644 --- a/reactos/lib/gdi32/misc/stubs.c +++ b/reactos/lib/gdi32/misc/stubs.c @@ -3887,24 +3887,6 @@ LPVIDMEM pvmList -/* - * @unimplemented - */ -BOOL STDCALL DdCreateSurfaceObject( -LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal, -BOOL bPrimarySurface -) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - - - - - - /* * @unimplemented */