[PATCH 1/3] d3dx9_36: Add support for DIB file in D3DXGetImageInfoFromFileInMemory.
Christian Costa
titan.costa at gmail.com
Mon Apr 22 07:17:13 CDT 2013
Wich DIB types ? Are you referring to BI_BITFIELDS compression ?
I just looked at windows codecs code and there this code to handle color
masks:
/* if this is a BITMAPINFOHEADER with BI_BITFIELDS compression, we need
to
read the extra fields */
if (This->bih.bV5Size == sizeof(BITMAPINFOHEADER) &&
This->bih.bV5Compression == BI_BITFIELDS)
{
This->palette_offset += 12;
}
For the rest it's the same thing:
/* In a packed DIB, the image follows the palette. */
ULONG palette_count, palette_size;
if (This->bih.bV5ClrUsed)
palette_count = This->bih.bV5ClrUsed;
else if (This->bih.bV5BitCount <= 8)
palette_count = 1 << This->bih.bV5BitCount;
else
palette_count = 0;
if (This->bih.bV5Size == sizeof(BITMAPCOREHEADER))
palette_size = sizeof(RGBTRIPLE) * palette_count;
else
palette_size = sizeof(RGBQUAD) * palette_count;
This->image_offset = This->palette_offset + palette_size;
Albeit windows codecs support also BITMAPCOREHEADER2, BITMAPV4HEADER,
BITMAPV5HEADER the same way as BITMAPINFOHEADER.
Is there still anything wrong ?
Christian
2013/4/22 Alexandre Julliard <julliard at winehq.org>
> Christian Costa <titan.costa at gmail.com> writes:
>
> > + if (header_size == sizeof(BITMAPINFOHEADER))
> > + {
> > + BITMAPINFOHEADER *header = (BITMAPINFOHEADER*)*data;
> > + ULONG count = header->biClrUsed;
> > +
> > + if (!count && header->biBitCount <= 8)
> > + count = 1 << header->biBitCount;
> > +
> > + offset = sizeof(BITMAPFILEHEADER) + header_size +
> sizeof(RGBQUAD) * count;
>
> This isn't correct for all DIB types.
>
> --
> Alexandre Julliard
> julliard at winehq.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20130422/1e47346c/attachment.html>
More information about the wine-devel
mailing list