diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-10-30 17:23:52 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2011-07-07 18:00:32 +0100 |
commit | 8216316867f07819b8e8b377f2633fbf8876abf7 (patch) | |
tree | 5fb03e66efdf93d013f2bdf07c272f9d3b589596 | |
parent | eecc8e06eb4bdfd4354144206d990cd9ccb69721 (diff) |
hw/xwin/glx: Better handling of SetPixelFormat() failure
Propagate and report the failure if SetPixelFormat() fails
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-rw-r--r-- | hw/xwin/glx/indirect.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c index 32322998c..ea4f97bf7 100644 --- a/hw/xwin/glx/indirect.c +++ b/hw/xwin/glx/indirect.c @@ -987,7 +987,7 @@ int glxWinReleaseTexImage(__GLXcontext *baseContext, * lists with the old one... */ -static void +static Bool glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawableTypeOverride) { __GLXscreen *screen = gc->base.pGlxScreen; @@ -1009,10 +1009,10 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable if (!SetPixelFormat(hdc, winConfig->pixelFormatIndex, NULL)) { ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); - return; + return FALSE; } - return; + return TRUE; } /* @@ -1044,7 +1044,7 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable if (fbConfigToPixelFormat(gc->base.config, &pfd, drawableTypeOverride)) { ErrorF("glxWinSetPixelFormat: fbConfigToPixelFormat failed\n"); - return; + return FALSE; } if (glxWinDebugSettings.dumpPFD) @@ -1060,7 +1060,7 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable if (pixelFormat == 0) { ErrorF("ChoosePixelFormat error: %s\n", glxWinErrorMessage()); - return; + return FALSE; } GLWIN_DEBUG_MSG("ChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat); @@ -1069,7 +1069,7 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable if (!SetPixelFormat(hdc, pixelFormat, &pfd)) { ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); - return; + return FALSE; } } else @@ -1078,7 +1078,7 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable if (pixelFormat == 0) { ErrorF("wglChoosePixelFormat error: %s\n", glxWinErrorMessage()); - return; + return FALSE; } GLWIN_DEBUG_MSG("wglChoosePixelFormat: chose pixelFormatIndex %d", pixelFormat); @@ -1087,9 +1087,11 @@ glxWinSetPixelFormat(__GLXWinContext *gc, HDC hdc, int bppOverride, int drawable if (!SetPixelFormat(hdc, pixelFormat, NULL)) { ErrorF("SetPixelFormat error: %s\n", glxWinErrorMessage()); - return; + return FALSE; } } + + return TRUE; } static HDC @@ -1140,7 +1142,13 @@ glxWinMakeDC(__GLXWinContext *gc, __GLXWinDrawable *draw, HDC *hdc, HWND *hwnd) gc->hwnd = *hwnd; /* We must select a pixelformat, but SetPixelFormat can only be called once for a window... */ - glxWinSetPixelFormat(gc, *hdc, 0, GLX_WINDOW_BIT); + if (!glxWinSetPixelFormat(gc, *hdc, 0, GLX_WINDOW_BIT)) + { + ErrorF("glxWinSetPixelFormat error: %s\n", glxWinErrorMessage()); + ReleaseDC(*hwnd, *hdc); + *hdc = NULL; + return NULL; + } } } break; |