Module: wine Branch: master Commit: 6fd40e3cae9ac9dcad85bd6b1636ae8d49f03880 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6fd40e3cae9ac9dcad85bd6b16...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Aug 29 12:03:17 2011 +0200
wineps: Simplify the DIB byte width computation.
---
dlls/wineps.drv/bitmap.c | 17 +---------------- 1 files changed, 1 insertions(+), 16 deletions(-)
diff --git a/dlls/wineps.drv/bitmap.c b/dlls/wineps.drv/bitmap.c index 7f2d507..33c72d8 100644 --- a/dlls/wineps.drv/bitmap.c +++ b/dlls/wineps.drv/bitmap.c @@ -31,22 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); /* Return the width of a DIB bitmap in bytes. DIB bitmap data is 32-bit aligned. */ static inline int get_dib_width_bytes( 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; break; - } - return 4 * words; + return ((width * depth + 31) / 8) & ~3; }