From b4f0adbf96060556a69099132bb43c5cffd0495e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 2 Dec 2006 18:06:42 -0800 Subject: [PATCH] wgl: Don't return prematurely if ConvertPixelFormatWGLtoGLX receives an invalid pixel format. --- dlls/winex11.drv/opengl.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 465f2ef430c..5779bceee04 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -876,20 +876,26 @@ static BOOL init_formats(Display *display, int screen, Visual *visual) */ static BOOL ConvertPixelFormatWGLtoGLX(Display *display, int iPixelFormat, int *fmt_index, int *fmt_count) { + int ret; + /* Init the list of pixel formats when we need it */ if(!WineGLPixelFormatListSize) init_formats(display, DefaultScreen(display), visual); if((iPixelFormat <= 0) || (iPixelFormat > WineGLPixelFormatListSize)) { ERR("invalid iPixelFormat %d\n", iPixelFormat); - return FALSE; + ret = FALSE; + *fmt_index = -1; + } + else { + ret = TRUE; + *fmt_index = WineGLPixelFormatList[iPixelFormat-1].fmt_index; } - *fmt_index = WineGLPixelFormatList[iPixelFormat-1].fmt_index; *fmt_count = WineGLPixelFormatListSize; TRACE("Returning fmt_index=%d, fmt_count=%d for iPixelFormat=%d\n", *fmt_index, *fmt_count, iPixelFormat); - return TRUE; + return ret; } /* Search our internal pixelformat list for the WGL format corresponding to the given fbconfig */ @@ -2272,7 +2278,7 @@ static GLboolean WINAPI X11DRV_wglGetPixelFormatAttribivARB(HDC hdc, int iPixelF * We don't have to fail yet as a program can specify an invaled iPixelFormat (lets say 0) if it wants to query * the number of supported WGL formats. Whether the iPixelFormat is valid is handled in the for-loop below. */ if(!ConvertPixelFormatWGLtoGLX(gdi_display, iPixelFormat, &fmt_index, &nWGLFormats)) { - ERR("Unable to convert iPixelFormat %d to a GLX one, expect problems!\n", iPixelFormat); + WARN("Unable to convert iPixelFormat %d to a GLX one!\n", iPixelFormat); } for (i = 0; i < nAttributes; ++i) {