From 67e7eda96c16417526e9659be0eeecf2b6edd4c1 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 25 Jun 2012 22:45:28 +0200 Subject: [PATCH] gdi32: Forward SwapBuffers to opengl32 which in turn calls GdiSwapBuffers. --- dlls/gdi32/gdi32.spec | 2 +- dlls/gdi32/opengl.c | 15 +++++++++++++++ dlls/gdi32/painting.c | 12 +++--------- dlls/opengl32/wgl.c | 5 +++-- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec index 98fe5c6b060..2a7edc3a5c5 100644 --- a/dlls/gdi32/gdi32.spec +++ b/dlls/gdi32/gdi32.spec @@ -218,7 +218,7 @@ @ stub GdiSetServerAttr # @ stub GdiStartDocEMF # @ stub GdiStartPageEMF -# @ stub GdiSwapBuffers +@ stdcall GdiSwapBuffers(long) @ stdcall GdiTransparentBlt(long long long long long long long long long long long) # @ stub GdiValidateHandle @ stub GdiWinWatchClose diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c index 18b5fcb0aaa..d2ab2aaedc7 100644 --- a/dlls/gdi32/opengl.c +++ b/dlls/gdi32/opengl.c @@ -43,6 +43,7 @@ static HMODULE opengl32; static INT (WINAPI *wglChoosePixelFormat)(HDC,const PIXELFORMATDESCRIPTOR *); static INT (WINAPI *wglDescribePixelFormat)(HDC,INT,UINT,PIXELFORMATDESCRIPTOR*); static BOOL (WINAPI *wglSetPixelFormat)(HDC,INT,const PIXELFORMATDESCRIPTOR*); +static BOOL (WINAPI *wglSwapBuffers)(HDC); static HDC default_hdc = 0; @@ -267,3 +268,17 @@ BOOL WINAPI SetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd ) } return wglSetPixelFormat( hdc, fmt, pfd ); } + +/****************************************************************************** + * SwapBuffers (GDI32.@) + */ +BOOL WINAPI SwapBuffers( HDC hdc ) +{ + if (!wglSwapBuffers) + { + if (!opengl32) opengl32 = LoadLibraryW( opengl32W ); + if (!(wglSwapBuffers = (void *)GetProcAddress( opengl32, "wglSwapBuffers" ))) + return 0; + } + return wglSwapBuffers( hdc ); +} diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index 4be8cb3f491..571a96ba26c 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -562,17 +562,11 @@ INT WINAPI GdiDescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes, /****************************************************************************** - * SwapBuffers [GDI32.@] - * Exchanges front and back buffers of window + * GdiSwapBuffers [GDI32.@] * - * PARAMS - * hdc [I] Device context whose buffers get swapped - * - * RETURNS - * Success: TRUE - * Failure: FALSE + * Probably not the correct semantics, it's supposed to be an internal backend for SwapBuffers. */ -BOOL WINAPI SwapBuffers( HDC hdc ) +BOOL WINAPI GdiSwapBuffers( HDC hdc ) { INT bRet = FALSE; DC * dc = get_dc_ptr( hdc ); diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 328cb63c855..79aefcd906d 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -90,6 +90,7 @@ const GLubyte * WINAPI wine_glGetString( GLenum name ); /* internal GDI functions */ extern INT WINAPI GdiDescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd ); extern BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd ); +extern BOOL WINAPI GdiSwapBuffers( HDC hdc ); /*********************************************************************** * wglSetPixelFormat(OPENGL32.@) @@ -560,7 +561,7 @@ BOOL WINAPI wglSwapLayerBuffers(HDC hdc, TRACE_(opengl)("(%p, %08x)\n", hdc, fuPlanes); if (fuPlanes & WGL_SWAP_MAIN_PLANE) { - if (!SwapBuffers(hdc)) return FALSE; + if (!GdiSwapBuffers(hdc)) return FALSE; fuPlanes &= ~WGL_SWAP_MAIN_PLANE; } @@ -1062,7 +1063,7 @@ void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params ) */ BOOL WINAPI DECLSPEC_HOTPATCH wglSwapBuffers( HDC hdc ) { - return SwapBuffers(hdc); + return GdiSwapBuffers(hdc); } /* This is for brain-dead applications that use OpenGL functions before even -- 2.11.4.GIT