Commit 2823e1d2 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wgl: Put the core functionality of X11DRV_SetPixelFormat in a separate function.

This is needed for a new X11DRV_SetPixelFormatWINE function which allows you to change the pixel format multiple times.
parent 56a41706
......@@ -1441,25 +1441,16 @@ int X11DRV_GetPixelFormat(X11DRV_PDEVICE *physDev) {
return physDev->current_pf;
}
/**
* X11DRV_SetPixelFormat
*
* Set the pixel-format id used by this DC
*/
BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
/* This function is the core of X11DRV_SetPixelFormat and X11DRV_SetPixelFormatWINE.
* Both functions are the same except that X11DRV_SetPixelFormatWINE allows you to
* set the pixel format multiple times. */
static BOOL internal_SetPixelFormat(X11DRV_PDEVICE *physDev,
int iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd) {
WineGLPixelFormat *fmt;
int value;
HWND hwnd;
TRACE("(%p,%d,%p)\n", physDev, iPixelFormat, ppfd);
if (!has_opengl()) {
ERR("No libGL on this box - disabling OpenGL support !\n");
return FALSE;
}
/* SetPixelFormat is not allowed on the X root_window e.g. GetDC(0) */
if(get_glxdrawable(physDev) == root_window)
{
......@@ -1474,9 +1465,6 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
return FALSE;
}
if(physDev->current_pf) /* cannot change it if already set */
return (physDev->current_pf == iPixelFormat);
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
hwnd = WindowFromDC(physDev->hdc);
......@@ -1527,6 +1515,28 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
return TRUE;
}
/**
* X11DRV_SetPixelFormat
*
* Set the pixel-format id used by this DC
*/
BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
int iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd) {
TRACE("(%p,%d,%p)\n", physDev, iPixelFormat, ppfd);
if (!has_opengl()) {
ERR("No libGL on this box - disabling OpenGL support !\n");
return FALSE;
}
if(physDev->current_pf) /* cannot change it if already set */
return (physDev->current_pf == iPixelFormat);
return internal_SetPixelFormat(physDev, iPixelFormat, ppfd);
}
/**
* X11DRV_wglCopyContext
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment