Alexandre Julliard : gdi32: Forward SetPixelFormat to opengl32 which in turn calls GdiSetPixelFormat.
Alexandre Julliard
julliard at winehq.org
Tue Jun 26 13:34:12 CDT 2012
Module: wine
Branch: master
Commit: c0139457285251f7ded38e9b9df48daebe8c58d7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c0139457285251f7ded38e9b9df48daebe8c58d7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 25 22:03:59 2012 +0200
gdi32: Forward SetPixelFormat to opengl32 which in turn calls GdiSetPixelFormat.
---
dlls/gdi32/gdi32.spec | 2 +-
dlls/gdi32/opengl.c | 15 +++++++++++++++
dlls/gdi32/painting.c | 15 +++------------
dlls/opengl32/wgl.c | 6 +++---
4 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 60988da..98fe5c6 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -214,7 +214,7 @@
@ stub GdiSetAttrs
@ stdcall GdiSetBatchLimit(long)
# @ stub GdiSetLastError
-# @ stub GdiSetPixelFormat
+@ stdcall GdiSetPixelFormat(long long ptr)
@ stub GdiSetServerAttr
# @ stub GdiStartDocEMF
# @ stub GdiStartPageEMF
diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c
index f021502..18b5fcb 100644
--- a/dlls/gdi32/opengl.c
+++ b/dlls/gdi32/opengl.c
@@ -42,6 +42,7 @@ static const WCHAR opengl32W[] = {'o','p','e','n','g','l','3','2','.','d','l','l
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 HDC default_hdc = 0;
@@ -252,3 +253,17 @@ INT WINAPI DescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPT
}
return wglDescribePixelFormat( hdc, fmt, size, pfd );
}
+
+/******************************************************************************
+ * SetPixelFormat (GDI32.@)
+ */
+BOOL WINAPI SetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd )
+{
+ if (!wglSetPixelFormat)
+ {
+ if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
+ if (!(wglSetPixelFormat = (void *)GetProcAddress( opengl32, "wglSetPixelFormat" )))
+ return 0;
+ }
+ return wglSetPixelFormat( hdc, fmt, pfd );
+}
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index e8c2882..4be8cb3 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -486,20 +486,11 @@ COLORREF WINAPI GetPixel( HDC hdc, INT x, INT y )
/******************************************************************************
- * SetPixelFormat [GDI32.@]
- * Sets pixel format of device context
+ * GdiSetPixelFormat [GDI32.@]
*
- * PARAMS
- * hdc [I] Device context to search for best pixel match
- * iPixelFormat [I] Pixel format index
- * ppfd [I] Pixel format for which a match is sought
- *
- * RETURNS
- * Success: TRUE
- * Failure: FALSE
+ * Probably not the correct semantics, it's supposed to be an internal backend for SetPixelFormat.
*/
-BOOL WINAPI SetPixelFormat( HDC hdc, INT iPixelFormat,
- const PIXELFORMATDESCRIPTOR *ppfd)
+BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
{
INT bRet = FALSE;
DC * dc = get_dc_ptr( hdc );
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 2a59e04..328cb63 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -48,7 +48,6 @@ WINE_DECLARE_DEBUG_CHANNEL(opengl);
static struct
{
PROC (WINAPI *p_wglGetProcAddress)(LPCSTR lpszProc);
- 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_GetPixelFormat)(HDC hdc);
@@ -88,7 +87,9 @@ static char* internal_gl_extensions = NULL;
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 );
/***********************************************************************
* wglSetPixelFormat(OPENGL32.@)
@@ -96,7 +97,7 @@ extern INT WINAPI GdiDescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORM
BOOL WINAPI wglSetPixelFormat( HDC hdc, INT iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd)
{
- return wine_wgl.p_SetPixelFormat(hdc, iPixelFormat, ppfd);
+ return GdiSetPixelFormat(hdc, iPixelFormat, ppfd);
}
/***********************************************************************
@@ -1086,7 +1087,6 @@ static BOOL process_attach(void)
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod_x11, "wine_tsx11_unlock" );
wine_wgl.p_wglGetProcAddress = (void *)GetProcAddress(mod_gdi32, "wglGetProcAddress");
- 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_GetPixelFormat = (void *)GetProcAddress(mod_gdi32, "GetPixelFormat");
More information about the wine-cvs
mailing list