Alexandre Julliard : gdi32/tests: Simplify the DIB byte width computation.

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


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jul 27 13:22:53 2011 +0200

gdi32/tests: Simplify the DIB byte width computation.

---

 dlls/gdi32/tests/bitmap.c |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index d5a39be..2a68597 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -255,25 +255,7 @@ static void test_createdibitmap(void)
 
 static INT DIB_GetWidthBytes( int width, int bpp )
 {
-    int words;
-
-    switch (bpp)
-    {
-	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;
-	case 32: words = width; break;
-
-        default:
-            words=0;
-            trace("Unknown depth %d, please report.\n", bpp );
-            assert(0);
-            break;
-    }
-    return 4 * words;
+    return ((width * bpp + 31) / 8) & ~3;
 }
 
 static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER *bmih)




More information about the wine-cvs mailing list