windowscodecs: Implement GetPixelFormat for the TGA decoder.

This commit is contained in:
Vincent Povirk 2010-06-07 16:36:27 -05:00 committed by Alexandre Julliard
parent bb6d9eaffb
commit df5a150b4f
1 changed files with 60 additions and 2 deletions

View File

@ -354,10 +354,68 @@ static HRESULT WINAPI TgaDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface,
static HRESULT WINAPI TgaDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode *iface, static HRESULT WINAPI TgaDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode *iface,
WICPixelFormatGUID *pPixelFormat) WICPixelFormatGUID *pPixelFormat)
{ {
TRACE("(%p,%p): stub\n", iface, pPixelFormat); TgaDecoder *This = decoder_from_frame(iface);
int attribute_bitcount;
TRACE("(%p,%p)\n", iface, pPixelFormat);
attribute_bitcount = This->header.image_descriptor & IMAGE_ATTRIBUTE_BITCOUNT_MASK;
if (attribute_bitcount)
{
FIXME("Need to read footer to find meaning of attribute bits\n");
return E_NOTIMPL; return E_NOTIMPL;
} }
switch (This->header.image_type & ~IMAGETYPE_RLE)
{
case IMAGETYPE_COLORMAPPED:
switch (This->header.depth)
{
case 8:
memcpy(pPixelFormat, &GUID_WICPixelFormat8bppIndexed, sizeof(GUID));
break;
default:
FIXME("Unhandled indexed color depth %u\n", This->header.depth);
return E_NOTIMPL;
}
break;
case IMAGETYPE_TRUECOLOR:
switch (This->header.depth)
{
case 16:
memcpy(pPixelFormat, &GUID_WICPixelFormat16bppBGR555, sizeof(GUID));
break;
case 24:
memcpy(pPixelFormat, &GUID_WICPixelFormat24bppBGR, sizeof(GUID));
break;
default:
FIXME("Unhandled truecolor depth %u\n", This->header.depth);
return E_NOTIMPL;
}
break;
case IMAGETYPE_GRAYSCALE:
switch (This->header.depth)
{
case 8:
memcpy(pPixelFormat, &GUID_WICPixelFormat8bppGray, sizeof(GUID));
break;
case 16:
memcpy(pPixelFormat, &GUID_WICPixelFormat16bppGray, sizeof(GUID));
break;
default:
FIXME("Unhandled grayscale depth %u\n", This->header.depth);
return E_NOTIMPL;
}
break;
default:
ERR("Unknown image type %u\n", This->header.image_type);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI TgaDecoder_Frame_GetResolution(IWICBitmapFrameDecode *iface, static HRESULT WINAPI TgaDecoder_Frame_GetResolution(IWICBitmapFrameDecode *iface,
double *pDpiX, double *pDpiY) double *pDpiX, double *pDpiY)
{ {