gdi32: Use the bpp info from the bitmap structure now that it's identical to the DIB one.

oldstable
Alexandre Julliard 2012-01-09 19:38:54 +01:00
parent 8946a33c4b
commit 66774baba3
2 changed files with 12 additions and 23 deletions

View File

@ -342,9 +342,7 @@ LONG WINAPI GetBitmapBits(
if (!bmp) return 0;
funcs = get_bitmap_funcs( bmp );
if (bmp->dib) dst_stride = get_bitmap_stride( bmp->dib->dsBmih.biWidth, bmp->dib->dsBmih.biBitCount );
else dst_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
dst_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
ret = max = dst_stride * bmp->bitmap.bmHeight;
if (!bits) goto done;
if (count > max) count = max;
@ -426,8 +424,7 @@ LONG WINAPI SetBitmapBits(
count = -count;
}
if (bmp->dib) src_stride = get_bitmap_stride( bmp->dib->dsBmih.biWidth, bmp->dib->dsBmih.biBitCount );
else src_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
src_stride = get_bitmap_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
count = min( count, src_stride * bmp->bitmap.bmHeight );
dst_stride = get_dib_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
@ -481,7 +478,7 @@ LONG WINAPI SetBitmapBits(
/* query the color info */
info->bmiHeader.biSize = sizeof(info->bmiHeader);
info->bmiHeader.biPlanes = 1;
info->bmiHeader.biBitCount = bmp->dib ? bmp->dib->dsBmih.biBitCount : bmp->bitmap.bmBitsPixel;
info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
info->bmiHeader.biCompression = BI_RGB;
info->bmiHeader.biXPelsPerMeter = 0;
info->bmiHeader.biYPelsPerMeter = 0;

View File

@ -975,25 +975,17 @@ static int fill_query_info( BITMAPINFO *info, BITMAPOBJ *bmp )
header.biWidth = bmp->bitmap.bmWidth;
header.biHeight = bmp->bitmap.bmHeight;
header.biPlanes = 1;
header.biBitCount = bmp->bitmap.bmBitsPixel;
if (bmp->dib)
switch (header.biBitCount)
{
header.biBitCount = bmp->dib->dsBm.bmBitsPixel;
switch (bmp->dib->dsBm.bmBitsPixel)
{
case 16:
case 32:
header.biCompression = BI_BITFIELDS;
break;
default:
header.biCompression = BI_RGB;
break;
}
}
else
{
header.biCompression = (bmp->bitmap.bmBitsPixel > 8) ? BI_BITFIELDS : BI_RGB;
header.biBitCount = bmp->bitmap.bmBitsPixel;
case 16:
case 32:
header.biCompression = BI_BITFIELDS;
break;
default:
header.biCompression = BI_RGB;
break;
}
header.biSizeImage = get_dib_image_size( (BITMAPINFO *)&header );