gdi32/tests: Simplify the DIB byte width computation.
This commit is contained in:
parent
4e3c649b9c
commit
afa7817d6e
|
@ -255,25 +255,7 @@ static void test_createdibitmap(void)
|
||||||
|
|
||||||
static INT DIB_GetWidthBytes( int width, int bpp )
|
static INT DIB_GetWidthBytes( int width, int bpp )
|
||||||
{
|
{
|
||||||
int words;
|
return ((width * bpp + 31) / 8) & ~3;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER *bmih)
|
static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER *bmih)
|
||||||
|
|
Loading…
Reference in New Issue