Module: wine Branch: master Commit: 096757c3dd96a2afa81fbcad3150b0f55fc45a40 URL: http://source.winehq.org/git/wine.git/?a=commit;h=096757c3dd96a2afa81fbcad31...
Author: Alexandre Julliard julliard@winehq.org Date: Thu May 3 16:10:17 2012 +0200
winex11: Remove redundant code in ChoosePixelFormat.
---
dlls/winex11.drv/opengl.c | 112 ++++++++++++--------------------------------- 1 files changed, 30 insertions(+), 82 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 20f9911..8f85023 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -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,105 +1315,71 @@ 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)) ) - { - bestDBuffer = dwFlags & PFD_DOUBLEBUFFER; - bestStereo = dwFlags & PFD_STEREO; - bestAlpha = alpha; - bestColor = color; - bestDepth = depth; - bestStencil = stencil; - bestAux = aux; - bestFormat = i; - continue; - } else if(bestAux != aux) { + 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; + bestColor = color; + bestDepth = depth; + bestStencil = stencil; + bestAux = aux; + bestFormat = i; }
if(bestFormat == -1) {