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