From 9f55f7097f9a4e11e5f4a9aa8f1c58a5754d9b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sun, 5 Jan 2014 20:57:51 +0000 Subject: [PATCH] [WIN32K] - Implement NtGdiSwapBuffers svn path=/trunk/; revision=61541 --- reactos/win32ss/gdi/ntgdi/wingl.c | 58 ++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/reactos/win32ss/gdi/ntgdi/wingl.c b/reactos/win32ss/gdi/ntgdi/wingl.c index b4aae45ec33..18023431702 100644 --- a/reactos/win32ss/gdi/ntgdi/wingl.c +++ b/reactos/win32ss/gdi/ntgdi/wingl.c @@ -128,7 +128,8 @@ NtGdiSetPixelFormat( return FALSE; } - if (!pdc->ipfdDevMax) IntGetipfdDevMax(pdc); + if (!pdc->ipfdDevMax) + IntGetipfdDevMax(pdc); if ( ipfd < 1 || ipfd > pdc->ipfdDevMax ) @@ -182,10 +183,59 @@ Exit: BOOL APIENTRY NtGdiSwapBuffers( - _In_ HDC hDC) + _In_ HDC hdc) { - UNIMPLEMENTED; - return FALSE; + PDC pdc; + PPDEVOBJ ppdev; + HWND hWnd; + PWNDOBJ pWndObj; + SURFOBJ *pso = NULL; + BOOL Ret = FALSE; + + pdc = DC_LockDc(hdc); + if (!pdc) + { + EngSetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + UserEnterExclusive(); + hWnd = UserGethWnd(hdc, &pWndObj); + UserLeave(); + + if (!hWnd) + { + EngSetLastError(ERROR_INVALID_WINDOW_STYLE); + goto Exit; + } + + ppdev = pdc->ppdev; + + /* + WndObj is needed so exit on NULL pointer. + */ + if (pWndObj) + pso = pWndObj->psoOwner; + else + { + EngSetLastError(ERROR_INVALID_PIXEL_FORMAT); + goto Exit; + } + + if (ppdev->flFlags & PDEV_META_DEVICE) + { + UNIMPLEMENTED; + goto Exit; + } + + if (ppdev->DriverFunctions.SwapBuffers) + { + Ret = ppdev->DriverFunctions.SwapBuffers(pso, pWndObj); + } + +Exit: + DC_UnlockDc(pdc); + return Ret; } /* EOF */