Commit 096757c3 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Remove redundant code in ChoosePixelFormat.

parent 416e79f3
...@@ -1291,17 +1291,8 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd) ...@@ -1291,17 +1291,8 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd)
if( !(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) ) { if( !(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) ) {
if( ((ppfd->dwFlags & PFD_DOUBLEBUFFER) != bestDBuffer) && if( ((ppfd->dwFlags & PFD_DOUBLEBUFFER) != bestDBuffer) &&
((dwFlags & PFD_DOUBLEBUFFER) == (ppfd->dwFlags & PFD_DOUBLEBUFFER)) ) ((dwFlags & PFD_DOUBLEBUFFER) == (ppfd->dwFlags & PFD_DOUBLEBUFFER)) )
{ goto found;
bestDBuffer = dwFlags & PFD_DOUBLEBUFFER;
bestStereo = dwFlags & PFD_STEREO;
bestAlpha = alpha;
bestColor = color;
bestDepth = depth;
bestStencil = stencil;
bestAux = aux;
bestFormat = i;
continue;
}
if(bestDBuffer != -1 && (dwFlags & PFD_DOUBLEBUFFER) != bestDBuffer) if(bestDBuffer != -1 && (dwFlags & PFD_DOUBLEBUFFER) != bestDBuffer)
continue; continue;
} }
...@@ -1310,17 +1301,8 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd) ...@@ -1310,17 +1301,8 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd)
if( !(ppfd->dwFlags & PFD_STEREO_DONTCARE) ) { if( !(ppfd->dwFlags & PFD_STEREO_DONTCARE) ) {
if( ((ppfd->dwFlags & PFD_STEREO) != bestStereo) && if( ((ppfd->dwFlags & PFD_STEREO) != bestStereo) &&
((dwFlags & PFD_STEREO) == (ppfd->dwFlags & PFD_STEREO)) ) ((dwFlags & PFD_STEREO) == (ppfd->dwFlags & PFD_STEREO)) )
{ goto found;
bestDBuffer = dwFlags & PFD_DOUBLEBUFFER;
bestStereo = dwFlags & PFD_STEREO;
bestAlpha = alpha;
bestColor = color;
bestDepth = depth;
bestStencil = stencil;
bestAux = aux;
bestFormat = i;
continue;
}
if(bestStereo != -1 && (dwFlags & PFD_STEREO) != bestStereo) if(bestStereo != -1 && (dwFlags & PFD_STEREO) != bestStereo)
continue; continue;
} }
...@@ -1333,91 +1315,63 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd) ...@@ -1333,91 +1315,63 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd)
* like cColorBits, cAlphaBits and friends if they are set to 0, so they are considered * like cColorBits, cAlphaBits and friends if they are set to 0, so they are considered
* as DONTCARE. At least Serious Sam TSE relies on this behavior. */ * as DONTCARE. At least Serious Sam TSE relies on this behavior. */
/* Color bits */
if(ppfd->cColorBits) { if(ppfd->cColorBits) {
if( ((ppfd->cColorBits > bestColor) && (color > bestColor)) || if( ((ppfd->cColorBits > bestColor) && (color > bestColor)) ||
((color >= ppfd->cColorBits) && (color < bestColor)) ) ((color >= ppfd->cColorBits) && (color < bestColor)) )
{ goto found;
bestDBuffer = dwFlags & PFD_DOUBLEBUFFER;
bestStereo = dwFlags & PFD_STEREO; if(bestColor != color) { /* Do further checks if the format is compatible */
bestAlpha = alpha;
bestColor = color;
bestDepth = depth;
bestStencil = stencil;
bestAux = aux;
bestFormat = i;
continue;
} else if(bestColor != color) { /* Do further checks if the format is compatible */
TRACE("color mismatch for iPixelFormat=%d\n", i+1); TRACE("color mismatch for iPixelFormat=%d\n", i+1);
continue; continue;
} }
} }
/* Alpha bits */
if(ppfd->cAlphaBits) { if(ppfd->cAlphaBits) {
if( ((ppfd->cAlphaBits > bestAlpha) && (alpha > bestAlpha)) || if( ((ppfd->cAlphaBits > bestAlpha) && (alpha > bestAlpha)) ||
((alpha >= ppfd->cAlphaBits) && (alpha < bestAlpha)) ) ((alpha >= ppfd->cAlphaBits) && (alpha < bestAlpha)) )
{ goto found;
bestDBuffer = dwFlags & PFD_DOUBLEBUFFER;
bestStereo = dwFlags & PFD_STEREO; if(bestAlpha != alpha) {
bestAlpha = alpha;
bestColor = color;
bestDepth = depth;
bestStencil = stencil;
bestAux = aux;
bestFormat = i;
continue;
} else if(bestAlpha != alpha) {
TRACE("alpha mismatch for iPixelFormat=%d\n", i+1); TRACE("alpha mismatch for iPixelFormat=%d\n", i+1);
continue; continue;
} }
} }
/* Depth bits */
if(ppfd->cDepthBits) { if(ppfd->cDepthBits) {
if( ((ppfd->cDepthBits > bestDepth) && (depth > bestDepth)) || if( ((ppfd->cDepthBits > bestDepth) && (depth > bestDepth)) ||
((depth >= ppfd->cDepthBits) && (depth < bestDepth)) ) ((depth >= ppfd->cDepthBits) && (depth < bestDepth)) )
{ goto found;
bestDBuffer = dwFlags & PFD_DOUBLEBUFFER;
bestStereo = dwFlags & PFD_STEREO; if(bestDepth != depth) {
bestAlpha = alpha;
bestColor = color;
bestDepth = depth;
bestStencil = stencil;
bestAux = aux;
bestFormat = i;
continue;
} else if(bestDepth != depth) {
TRACE("depth mismatch for iPixelFormat=%d\n", i+1); TRACE("depth mismatch for iPixelFormat=%d\n", i+1);
continue; continue;
} }
} }
/* Stencil bits */
if(ppfd->cStencilBits) { if(ppfd->cStencilBits) {
if( ((ppfd->cStencilBits > bestStencil) && (stencil > bestStencil)) || if( ((ppfd->cStencilBits > bestStencil) && (stencil > bestStencil)) ||
((stencil >= ppfd->cStencilBits) && (stencil < bestStencil)) ) ((stencil >= ppfd->cStencilBits) && (stencil < bestStencil)) )
{ goto found;
bestDBuffer = dwFlags & PFD_DOUBLEBUFFER;
bestStereo = dwFlags & PFD_STEREO; if(bestStencil != stencil) {
bestAlpha = alpha;
bestColor = color;
bestDepth = depth;
bestStencil = stencil;
bestAux = aux;
bestFormat = i;
continue;
} else if(bestStencil != stencil) {
TRACE("stencil mismatch for iPixelFormat=%d\n", i+1); TRACE("stencil mismatch for iPixelFormat=%d\n", i+1);
continue; continue;
} }
} }
/* Aux buffers */
if(ppfd->cAuxBuffers) { if(ppfd->cAuxBuffers) {
if( ((ppfd->cAuxBuffers > bestAux) && (aux > bestAux)) || if( ((ppfd->cAuxBuffers > bestAux) && (aux > bestAux)) ||
((aux >= ppfd->cAuxBuffers) && (aux < bestAux)) ) ((aux >= ppfd->cAuxBuffers) && (aux < bestAux)) )
{ goto found;
if(bestAux != aux) {
TRACE("aux mismatch for iPixelFormat=%d\n", i+1);
continue;
}
}
continue;
found:
bestDBuffer = dwFlags & PFD_DOUBLEBUFFER; bestDBuffer = dwFlags & PFD_DOUBLEBUFFER;
bestStereo = dwFlags & PFD_STEREO; bestStereo = dwFlags & PFD_STEREO;
bestAlpha = alpha; bestAlpha = alpha;
...@@ -1426,12 +1380,6 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd) ...@@ -1426,12 +1380,6 @@ int X11DRV_ChoosePixelFormat(PHYSDEV dev, const PIXELFORMATDESCRIPTOR *ppfd)
bestStencil = stencil; bestStencil = stencil;
bestAux = aux; bestAux = aux;
bestFormat = i; bestFormat = i;
continue;
} else if(bestAux != aux) {
TRACE("aux mismatch for iPixelFormat=%d\n", i+1);
continue;
}
}
} }
if(bestFormat == -1) { if(bestFormat == -1) {
......
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