Fix some crach in ddraw.dll startup process for surface, we still got crach and surfa...
[reactos.git] / reactos / lib / ddraw / hal / surface_hal.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS
5 * FILE: lib/ddraw/hal/surface.c
6 * PURPOSE: DirectDraw HAL Implementation
7 * PROGRAMMER: Magnus Olsen, Maarten Bosma
8 *
9 */
10
11 #include "rosdraw.h"
12
13 HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
14 LPDIRECTDRAWSURFACE7 src, LPRECT rSrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
15 {
16
17 IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
18 IDirectDrawSurfaceImpl* That = (IDirectDrawSurfaceImpl*)src;
19
20 if (!(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags & DDHAL_SURFCB32_BLT))
21 {
22 return DDERR_NODRIVERSUPPORT;
23 }
24
25 DDHAL_BLTDATA BltData;
26 BltData.lpDD = &This->owner->DirectDrawGlobal;
27 BltData.dwFlags = dwFlags;
28 BltData.lpDDDestSurface = &This->Local;
29 if(rDest) BltData.rDest = *(RECTL*)rDest;
30 if(rSrc) BltData.rSrc = *(RECTL*)rSrc;
31 if(That) BltData.lpDDSrcSurface = &That->Local;
32 if(lpbltfx) BltData.bltFX = *lpbltfx;
33
34 if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.Blt(&BltData) != DDHAL_DRIVER_HANDLED)
35 {
36 return DDERR_NODRIVERSUPPORT;
37 }
38
39 return BltData.ddRVal;
40 }