Alexandre Julliard : gdi32: Forward DescribePixelFormat to opengl32 which in turn calls GdiDescribePixelFormat .

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


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun 25 21:59:11 2012 +0200

gdi32: Forward DescribePixelFormat to opengl32 which in turn calls GdiDescribePixelFormat.

---

 dlls/gdi32/gdi32.spec |    2 +-
 dlls/gdi32/opengl.c   |   15 +++++++++++++++
 dlls/gdi32/painting.c |   17 ++++-------------
 dlls/opengl32/wgl.c   |   11 ++++++-----
 4 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index c723af3..60988da 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -169,7 +169,7 @@
 @ stub GdiDeleteLocalDC
 @ stub GdiDeleteLocalObject
 # @ stub GdiDeleteSpoolFileHandle
-# @ stub GdiDescribePixelFormat
+@ stdcall GdiDescribePixelFormat(long long long ptr)
 @ stub GdiDllInitialize
 @ stdcall GdiDrawStream(long long ptr)
 # @ stub GdiEndDocEMF
diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c
index 11f7395..f021502 100644
--- a/dlls/gdi32/opengl.c
+++ b/dlls/gdi32/opengl.c
@@ -41,6 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl);
 static const WCHAR opengl32W[] = {'o','p','e','n','g','l','3','2','.','d','l','l',0};
 static HMODULE opengl32;
 static INT (WINAPI *wglChoosePixelFormat)(HDC,const PIXELFORMATDESCRIPTOR *);
+static INT (WINAPI *wglDescribePixelFormat)(HDC,INT,UINT,PIXELFORMATDESCRIPTOR*);
 
 static HDC default_hdc = 0;
 
@@ -237,3 +238,17 @@ INT WINAPI ChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR *pfd )
     }
     return wglChoosePixelFormat( hdc, pfd );
 }
+
+/******************************************************************************
+ *		DescribePixelFormat (GDI32.@)
+ */
+INT WINAPI DescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd )
+{
+    if (!wglDescribePixelFormat)
+    {
+        if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
+        if (!(wglDescribePixelFormat = (void *)GetProcAddress( opengl32, "wglDescribePixelFormat" )))
+            return 0;
+    }
+    return wglDescribePixelFormat( hdc, fmt, size, pfd );
+}
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 7f98e25..e8c2882 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -547,21 +547,12 @@ INT WINAPI GetPixelFormat( HDC hdc )
 
 
 /******************************************************************************
- * DescribePixelFormat [GDI32.@]
- * Gets info about pixel format from DC
+ * GdiDescribePixelFormat [GDI32.@]
  *
- * PARAMS
- *    hdc          [I] Device context
- *    iPixelFormat [I] Pixel format selector
- *    nBytes       [I] Size of buffer
- *    ppfd         [O] Pointer to structure to receive pixel format data
- *
- * RETURNS
- *    Success: Maximum pixel format index of the device context
- *    Failure: 0
+ * Probably not the correct semantics, it's supposed to be an internal backend for DescribePixelFormat.
  */
-INT WINAPI DescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
-                                LPPIXELFORMATDESCRIPTOR ppfd )
+INT WINAPI GdiDescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
+                                   LPPIXELFORMATDESCRIPTOR ppfd )
 {
     INT ret = 0;
     DC * dc = get_dc_ptr( hdc );
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index cd4c6ff..2a59e04 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -51,7 +51,6 @@ static struct
     BOOL  (WINAPI *p_SetPixelFormat)(HDC hdc, INT iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd);
     BOOL  (WINAPI *p_wglMakeCurrent)(HDC hdc, HGLRC hglrc);
     HGLRC (WINAPI *p_wglCreateContext)(HDC hdc);
-    INT   (WINAPI *p_DescribePixelFormat)(HDC hdc, INT iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd);
     INT   (WINAPI *p_GetPixelFormat)(HDC hdc);
 
     /* internal WGL functions */
@@ -89,6 +88,8 @@ static char* internal_gl_extensions = NULL;
 
 const GLubyte * WINAPI wine_glGetString( GLenum name );
 
+extern INT WINAPI GdiDescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd );
+
 /***********************************************************************
  *		 wglSetPixelFormat(OPENGL32.@)
  */
@@ -184,7 +185,7 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
                  ppfd->cColorBits, ppfd->cRedBits, ppfd->cGreenBits, ppfd->cBlueBits, ppfd->cAlphaBits,
                  ppfd->cAccumBits, ppfd->cDepthBits, ppfd->cStencilBits, ppfd->cAuxBuffers );
 
-    count = wine_wgl.p_DescribePixelFormat( hdc, 0, 0, NULL );
+    count = GdiDescribePixelFormat( hdc, 0, 0, NULL );
     if (!count) return 0;
 
     best_format = 0;
@@ -197,7 +198,7 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
 
     for (i = 1; i <= count; i++)
     {
-        if (!wine_wgl.p_DescribePixelFormat( hdc, i, sizeof(format), &format )) continue;
+        if (!GdiDescribePixelFormat( hdc, i, sizeof(format), &format )) continue;
 
         if (ppfd->iPixelType != format.iPixelType)
         {
@@ -338,8 +339,9 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
 INT WINAPI wglDescribePixelFormat(HDC hdc, INT iPixelFormat, UINT nBytes,
                                 LPPIXELFORMATDESCRIPTOR ppfd)
 {
-  return wine_wgl.p_DescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
+  return GdiDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
 }
+
 /***********************************************************************
  *		wglGetPixelFormat (OPENGL32.@)
  */
@@ -1087,7 +1089,6 @@ static BOOL process_attach(void)
   wine_wgl.p_SetPixelFormat = (void *)GetProcAddress(mod_gdi32, "SetPixelFormat");
   wine_wgl.p_wglMakeCurrent = (void *)GetProcAddress(mod_gdi32, "wglMakeCurrent");
   wine_wgl.p_wglCreateContext = (void *)GetProcAddress(mod_gdi32, "wglCreateContext");
-  wine_wgl.p_DescribePixelFormat = (void *)GetProcAddress(mod_gdi32, "DescribePixelFormat");
   wine_wgl.p_GetPixelFormat = (void *)GetProcAddress(mod_gdi32, "GetPixelFormat");
 
   /* internal WGL functions */




More information about the wine-cvs mailing list