winex11.drv: Replace switch case with algorithm

André Hentschel nerv at dawncrow.de
Fri Jun 4 09:38:15 CDT 2010


---
 dlls/winex11.drv/bitblt.c |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index 653e418..928b552 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1322,22 +1322,8 @@ static BOOL client_side_dib_copy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc
       return FALSE;
     }
 
-    switch (dstDib.dsBm.bmBitsPixel)
-    {
-      case 15:
-      case 16:
-        bytesPerPixel = 2;
-        break;
-      case 24:
-        bytesPerPixel = 3;
-        break;
-      case 32:
-        bytesPerPixel = 4;
-        break;
-      default:
-        FIXME("don't know how to work with a depth of %d\n", physDevSrc->depth);
-        return FALSE;
-    }
+    bytesPerPixel = dstDib.dsBm.bmBitsPixel / 8;
+    if (dstDib.dsBm.bmBitsPixel % 8) bytesPerPixel++;
 
     bytesToCopy = width * bytesPerPixel;
 
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list