Alexandre Julliard : winex11: Simplify the DIB byte width computation.

Alexandre Julliard julliard at winehq.org
Mon Aug 29 11:28:35 CDT 2011


Module: wine
Branch: master
Commit: 8cf6424057fb7c055fee915c00ab213486f4fe1a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8cf6424057fb7c055fee915c00ab213486f4fe1a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug 29 12:03:21 2011 +0200

winex11: Simplify the DIB byte width computation.

---

 dlls/winex11.drv/dib.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 812117a..3630c3e 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -154,23 +154,7 @@ static inline int X11DRV_DIB_GetXImageWidthBytes( int width, int depth )
  */
 static int X11DRV_DIB_GetDIBWidthBytes( int width, int depth )
 {
-    int words;
-
-    switch(depth)
-    {
-    case 1:  words = (width + 31) / 32; break;
-    case 4:  words = (width + 7) / 8; break;
-    case 8:  words = (width + 3) / 4; break;
-    case 15:
-    case 16: words = (width + 1) / 2; break;
-    case 24: words = (width * 3 + 3) / 4; break;
-    default:
-        WARN("(%d): Unsupported depth\n", depth );
-        /* fall through */
-    case 32:
-        words = width;
-    }
-    return 4 * words;
+    return ((width * depth + 31) / 8) & ~3;
 }
 
 




More information about the wine-cvs mailing list