[PATCH] simplify convoluted code in dummy LoadPalette

Antoine Martin antoine at nagafix.co.uk
Tue Sep 20 15:54:36 UTC 2016


Only the 15-bit mode does anything different,
make that clearer and remove the redundant code for other bit depths

Signed-off-by: Antoine Martin <antoine at nagafix.co.uk>
---
 src/dummy_driver.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/dummy_driver.c b/src/dummy_driver.c
index c84000f..5e0bc03 100644
--- a/src/dummy_driver.c
+++ b/src/dummy_driver.c
@@ -492,26 +492,17 @@ DUMMYLoadPalette(
    LOCO *colors,
    VisualPtr pVisual
 ){
-   int i, index, shift, Gshift;
+   int i, index, shift=0;
    DUMMYPtr dPtr = DUMMYPTR(pScrn);
 
-   switch(pScrn->depth) {
-   case 15:	
-	shift = Gshift = 1;
-	break;
-   case 16:
-	shift = 0; 
-        Gshift = 0;
-	break;
-   default:
-	shift = Gshift = 0;
-	break;
+   if (pScrn->depth==15) {
+	shift = 1
    }
 
    for(i = 0; i < numColors; i++) {
        index = indices[i];
        dPtr->colors[index].red = colors[index].red << shift;
-       dPtr->colors[index].green = colors[index].green << Gshift;
+       dPtr->colors[index].green = colors[index].green << shift;
        dPtr->colors[index].blue = colors[index].blue << shift;
    } 
 
-- 
2.7.4



More information about the xorg-devel mailing list