windowscodecs: Support more formats in the BMP encoder.

This commit is contained in:
Vincent Povirk 2009-09-23 13:26:25 -05:00 committed by Alexandre Julliard
parent 48cf4536e5
commit 64146fa97e

View File

@ -47,6 +47,13 @@ struct bmp_pixelformat {
static const struct bmp_pixelformat formats[] = {
{&GUID_WICPixelFormat24bppBGR, 24, BI_RGB},
{&GUID_WICPixelFormat16bppBGR555, 16, BI_RGB},
{&GUID_WICPixelFormat16bppBGR565, 16, BI_BITFIELDS, 0xf800, 0x7e0, 0x1f, 0},
{&GUID_WICPixelFormat32bppBGR, 32, BI_RGB},
#if 0
/* Windows doesn't seem to support this one. */
{&GUID_WICPixelFormat32bppBGRA, 32, BI_BITFIELDS, 0xff0000, 0xff00, 0xff, 0xff000000},
#endif
{NULL}
};
@ -338,6 +345,19 @@ static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface)
bih.bV5ClrUsed = 0;
bih.bV5ClrImportant = 0;
if (This->format->compression == BI_BITFIELDS)
{
if (This->format->alphamask)
bih.bV5Size = info_size = sizeof(BITMAPV4HEADER);
else
info_size = sizeof(BITMAPINFOHEADER)+12;
bih.bV5RedMask = This->format->redmask;
bih.bV5GreenMask = This->format->greenmask;
bih.bV5BlueMask = This->format->bluemask;
bih.bV5AlphaMask = This->format->alphamask;
bih.bV5AlphaMask = LCS_DEVICE_RGB;
}
bfh.bfSize = sizeof(BITMAPFILEHEADER) + info_size + bih.bV5SizeImage;
bfh.bfOffBits = sizeof(BITMAPFILEHEADER) + info_size;