Alexandre Julliard : gdi32: Forward SwapBuffers to opengl32 which in turn calls GdiSwapBuffers.

Alexandre Julliard julliard at winehq.org
Tue Jun 26 13:34:12 CDT 2012


Module: wine
Branch: master
Commit: 67e7eda96c16417526e9659be0eeecf2b6edd4c1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=67e7eda96c16417526e9659be0eeecf2b6edd4c1

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun 25 22:45:28 2012 +0200

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 98fe5c6..2a7edc3 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 18b5fcb..d2ab2aa 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 4be8cb3..571a96b 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 328cb63..79aefcd 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




More information about the wine-cvs mailing list