* Source cleanup.
* 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.
Modified: trunk/reactos/lib/ddraw/hal/ddraw_hal.c
Modified: trunk/reactos/lib/ddraw/main/ddraw_main.c
_____
Modified: trunk/reactos/lib/ddraw/hal/ddraw_hal.c
--- trunk/reactos/lib/ddraw/hal/ddraw_hal.c 2005-11-01 13:52:22 UTC
(rev 18930)
+++ trunk/reactos/lib/ddraw/hal/ddraw_hal.c 2005-11-01 14:46:34 UTC
(rev 18931)
@@ -447,24 +447,19 @@
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 @@
{
return DDERR_NODRIVERSUPPORT;
}
-
- BOOL dummy;
- DdReenableDirectDrawObject(&This->DirectDrawGlobal, &dummy);
-
+
return mode.ddRVal;
}
-#endif
+
_____
Modified: trunk/reactos/lib/ddraw/main/ddraw_main.c
--- trunk/reactos/lib/ddraw/main/ddraw_main.c 2005-11-01 13:52:22 UTC
(rev 18930)
+++ trunk/reactos/lib/ddraw/main/ddraw_main.c 2005-11-01 14:46:34 UTC
(rev 18931)
@@ -83,20 +83,35 @@
DWORD
dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
{
IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+ 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;
+ }
- /* FIXME implement hal setMode */
- if(Hal_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight,
- dwBPP, dwRefreshRate,
dwFlags) == DD_OK)
- {
- 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)