wgl: Make sure onscreen pixelformats are on top in wglChoosePixelFormatARB.

This commit is contained in:
Roderick Colenbrander 2007-08-10 15:35:02 +02:00 committed by Alexandre Julliard
parent 5e9ced90f7
commit f879f69f98
1 changed files with 26 additions and 18 deletions

View File

@ -984,7 +984,7 @@ static WineGLPixelFormat* ConvertPixelFormatWGLtoGLX(Display *display, int iPixe
} }
/* Search our internal pixelformat list for the WGL format corresponding to the given fbconfig */ /* Search our internal pixelformat list for the WGL format corresponding to the given fbconfig */
static int ConvertPixelFormatGLXtoWGL(Display *display, int fmt_id) static WineGLPixelFormat* ConvertPixelFormatGLXtoWGL(Display *display, int fmt_id)
{ {
int i; int i;
@ -995,11 +995,11 @@ static int ConvertPixelFormatGLXtoWGL(Display *display, int fmt_id)
for(i=0; i<WineGLPixelFormatListSize; i++) { for(i=0; i<WineGLPixelFormatListSize; i++) {
if(WineGLPixelFormatList[i].fmt_id == fmt_id) { if(WineGLPixelFormatList[i].fmt_id == fmt_id) {
TRACE("Returning iPixelFormat %d for fmt_id 0x%x\n", WineGLPixelFormatList[i].iPixelFormat, fmt_id); TRACE("Returning iPixelFormat %d for fmt_id 0x%x\n", WineGLPixelFormatList[i].iPixelFormat, fmt_id);
return WineGLPixelFormatList[i].iPixelFormat; return &WineGLPixelFormatList[i];
} }
} }
TRACE("No compatible format found for fmt_id 0x%x\n", fmt_id); TRACE("No compatible format found for fmt_id 0x%x\n", fmt_id);
return 0; return NULL;
} }
/** /**
@ -2513,8 +2513,9 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
int nCfgs = 0; int nCfgs = 0;
UINT it; UINT it;
int fmt_id; int fmt_id;
int fmt = 0; WineGLPixelFormat *fmt;
int pfmt_it = 0; int pfmt_it = 0;
int run;
TRACE("(%p, %p, %p, %d, %p, %p): hackish\n", hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats); TRACE("(%p, %p, %p, %d, %p, %p): hackish\n", hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats);
if (NULL != pfAttribFList) { if (NULL != pfAttribFList) {
@ -2537,6 +2538,8 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
/* Loop through all matching formats and check if they are suitable. /* Loop through all matching formats and check if they are suitable.
* Note that this function should at max return nMaxFormats different formats */ * Note that this function should at max return nMaxFormats different formats */
for(run=0; run < 2; run++)
{
for (it = 0; it < nCfgs; ++it) { for (it = 0; it < nCfgs; ++it) {
gl_test = pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id); gl_test = pglXGetFBConfigAttrib(gdi_display, cfgs[it], GLX_FBCONFIG_ID, &fmt_id);
if (gl_test) { if (gl_test) {
@ -2549,12 +2552,17 @@ static GLboolean WINAPI X11DRV_wglChoosePixelFormatARB(HDC hdc, const int *piAtt
if(!fmt) if(!fmt)
continue; continue;
/* During the first run we only want onscreen formats and during the second only offscreen 'XOR' */
if( ((run == 0) && fmt->offscreenOnly) || ((run == 1) && !fmt->offscreenOnly) )
continue;
if(pfmt_it < nMaxFormats) { if(pfmt_it < nMaxFormats) {
piFormats[pfmt_it] = fmt; piFormats[pfmt_it] = fmt->iPixelFormat;
TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]); TRACE("at %d/%d found FBCONFIG_ID 0x%x (%d)\n", it + 1, nCfgs, fmt_id, piFormats[pfmt_it]);
} }
pfmt_it++; pfmt_it++;
} }
}
*nNumFormats = pfmt_it; *nNumFormats = pfmt_it;
/** free list */ /** free list */