* Source cleanup.
authorMagnus Olsen <magnus@greatlord.com>
Tue, 1 Nov 2005 14:46:34 +0000 (14:46 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Tue, 1 Nov 2005 14:46:34 +0000 (14:46 +0000)
* SetMode adding a check see if it same reslution or not if it not same we change it.
* SetMode adding correct check for hal or hel. choice hal if it the drv provide it.

svn path=/trunk/; revision=18931

reactos/lib/ddraw/hal/ddraw_hal.c
reactos/lib/ddraw/main/ddraw_main.c

index 9565a5b..3d4775b 100644 (file)
@@ -447,24 +447,19 @@ HRESULT Hal_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface)
     return  FlipGdi.ddRVal;    
 }
 
-HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, 
-                                                    DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
-{
-    DX_STUB;
-}
 
-#if 0
+
 HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, 
                                                     DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
 {
-    IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-  
+    IDirectDrawImpl* This = (IDirectDrawImpl*)iface;   
+       DDHAL_SETMODEDATA mode;
+
     if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)) 
     {
         return DDERR_NODRIVERSUPPORT;
     }
-
-    DDHAL_SETMODEDATA mode;
+    
     mode.lpDD = &This->DirectDrawGlobal;
     mode.ddRVal = DDERR_NODRIVERSUPPORT;
 
@@ -476,11 +471,8 @@ HRESULT Hal_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD
     {
         return DDERR_NODRIVERSUPPORT;
     } 
-
-       BOOL dummy;
-       DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
-    
+          
        return mode.ddRVal;
 }
-#endif
+
 
index ed7e903..88401bd 100644 (file)
@@ -83,20 +83,35 @@ HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidt
                                                                 DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
 {
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-
-    /* FIXME implement hal setMode */
-    if(Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, 
-                                            dwBPP, dwRefreshRate, dwFlags) == DD_OK)
-    {
-        return DD_OK;
+       BOOL dummy = TRUE;
+       DWORD ret;
+       
+       /* FIXME check the refresrate if it same if it not same do the mode switch */
+       if ((This->DirectDrawGlobal.vmiData.dwDisplayHeight == dwHeight) && 
+               (This->DirectDrawGlobal.vmiData.dwDisplayWidth == dwWidth)  && 
+               (This->DirectDrawGlobal.vmiData.ddpfDisplay.dwRGBBitCount == dwBPP))  
+               {
+          
+                 return DD_OK;
+               }
+
+       /* Check use the Hal or Hel for SetMode */
+       if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETMODE)
+       {
+               ret = Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate, dwFlags);       
     }    
-
-    DWORD ret = Hel_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate, dwFlags);
-
-       BOOL dummy;
-       DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
-
-    return ret; 
+       else 
+       {
+               ret = Hel_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP, dwRefreshRate, dwFlags);
+       }
+       
+       if (ret == DD_OK)
+       {
+               DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
+               /* FIXME fill the This->DirectDrawGlobal.vmiData right */
+       }
+  
+       return ret;
 }
 
 ULONG WINAPI Main_DirectDraw_AddRef (LPDIRECTDRAW7 iface)