Implement IDirectDrawSurface::Blt for HAL
authorMaarten Bosma <maarten@bosma.de>
Sun, 30 Oct 2005 15:34:03 +0000 (15:34 +0000)
committerMaarten Bosma <maarten@bosma.de>
Sun, 30 Oct 2005 15:34:03 +0000 (15:34 +0000)
svn path=/trunk/; revision=18884

reactos/lib/ddraw/hal/surface_hal.c
reactos/lib/ddraw/main/surface_main.c
reactos/lib/ddraw/rosdraw.h

index e4654c5..f313ca0 100644 (file)
 
 #include "rosdraw.h"
 
-HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rdst,
-                         LPDIRECTDRAWSURFACE7 src, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
+HRESULT Hal_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7 iface, LPRECT rDest,
+                         LPDIRECTDRAWSURFACE7 src, LPRECT rSrc, DWORD dwFlags, LPDDBLTFX lpbltfx)
 {
-  
-       DDHAL_BLTDATA BltData;
-    IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+    IDirectDrawSurfaceImpl* This = (IDirectDrawSurfaceImpl*)iface;
+    IDirectDrawSurfaceImpl* That = (IDirectDrawSurfaceImpl*)src;
        
-       if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags  & DDHAL_SURFCB32_BLT)) 
+       if (!(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.dwFlags  & DDHAL_SURFCB32_BLT)) 
        {
                return DDERR_NODRIVERSUPPORT;
        }
 
-       BltData.lpDD = &This->DirectDrawGlobal;
-       /* RtlCopyMemory( &BltData.bltFX, lpbltfx,sizeof(DDBLTFX)); */
-       BltData.dwFlags =  dwFlags;
-
-    /* FIXME blt is not complete */
+       DDHAL_BLTDATA BltData;
+       BltData.lpDD = &This->owner->DirectDrawGlobal;
+       BltData.dwFlags = dwFlags;
+       BltData.lpDDDestSurface = This->local;
+    if(rDest) BltData.rDest = *(RECTL*)rDest;
+    if(rSrc) BltData.rSrc = *(RECTL*)rSrc;
+    if(That) BltData.lpDDSrcSurface = That->local;
+       if(lpbltfx) BltData.bltFX = *lpbltfx;
 
-       if (This->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.Blt(&BltData) != DDHAL_DRIVER_HANDLED)
+       if (This->owner->DirectDrawGlobal.lpDDCBtmp->HALDDSurface.Blt(&BltData) != DDHAL_DRIVER_HANDLED)
        {
           return DDERR_NODRIVERSUPPORT;
        }
        
        return BltData.ddRVal;
-
 }
 
index 5f89c46..247deff 100644 (file)
@@ -41,38 +41,33 @@ HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIREC
                        return CanCreateData.ddRVal;
        }
 
-       /* down here we got a crach */
-
        /* surface global struct */
-       DDRAWI_DDRAWSURFACE_GBL Global;
-       memset(&Global, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
-       Global.lpDD = &This->owner->DirectDrawGlobal;   
-       Global.wHeight = This->owner->Height;
-       Global.wWidth = This->owner->Width;
-       Global.dwLinearSize =  Global.wWidth * This->owner->Bpp/8;
+       memset(&This->Global, 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
+       This->Global.lpDD = &This->owner->DirectDrawThis->Global;       
+       This->Global.wHeight = This->owner->Height;
+       This->Global.wWidth = This->owner->Width;
+       This->Global.dwLinearSize =  This->Global.wWidth * This->owner->Bpp/8;
        
        /* surface more struct */
-       DDRAWI_DDRAWSURFACE_MORE More;
-       memset(&More, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE));
-       More.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
+       memset(&This->More, 0, sizeof(DDRAWI_DDRAWSURFACE_MORE));
+       This->More.dwSize = sizeof(DDRAWI_DDRAWSURFACE_MORE);
 
        /* surface local struct */
-       DDRAWI_DDRAWSURFACE_LCL Local;
-       memset(&Local, 0, sizeof(DDRAWI_DDRAWSURFACE_LCL));
-       Local.lpGbl = &Global;
-       Local.lpSurfMore = &More;
-       Local.ddsCaps = *(DDSCAPS*)&pDDSD->ddsCaps;
+       memset(&This->Local, 0, sizeof(DDRAWI_DDRAWSURFACE_LCL));
+       This->Local.lpGbl = &This->Global;
+       This->Local.lpSurfMore = &This->More;
+       This->Local.ddsCaps = *(DDSCAPS*)&pDDSD->ddsCaps;
 
        /* we need to set some flags if we create the primary surface */
        if(pDDSD->ddsCaps.dwCaps == DDSCAPS_PRIMARYSURFACE)
        {
-               Local.dwFlags |= DDRAWISURF_FRONTBUFFER;
-               Global.dwGlobalFlags |= DDRAWISURFGBL_ISGDISURFACE;
+               This->Local.dwFlags |= DDRAWISURF_FRONTBUFFER;
+               This->Global.dwGlobalFlags |= DDRAWISURFGBL_ISGDISURFACE;
        }
 
        /* for the double pointer below */
        DDRAWI_DDRAWSURFACE_LCL *pLocal[2]; 
-       pLocal[0] = &Local; 
+       pLocal[0] = &This->Local; 
     pLocal[1] = NULL;  // we need this one for bad written drivers
 
        /* the parameter struct */
@@ -84,7 +79,6 @@ HRESULT WINAPI Main_DDrawSurface_Initialize (LPDIRECTDRAWSURFACE7 iface, LPDIREC
        CreateData.lplpSList = pLocal;  
        
        /* this is the call we were waiting for */
-       MessageBox(0,0,0,0);
        if(This->owner->DirectDrawGlobal.lpDDCBtmp->HALDD.CreateSurface(&CreateData) == DDHAL_DRIVER_NOTHANDLED)
                return DDERR_INVALIDPARAMS;
        
index c2cad52..05245c7 100644 (file)
@@ -41,6 +41,10 @@ typedef struct
 
     LONG ref;
 
+       DDRAWI_DDRAWSURFACE_GBL Global;
+       DDRAWI_DDRAWSURFACE_MORE More;
+       DDRAWI_DDRAWSURFACE_LCL Local;
+
     IDirectDrawImpl* owner;
 
 } IDirectDrawSurfaceImpl;