windowscodecs: Implement GetResolution for BMP decoder.

This commit is contained in:
Vincent Povirk 2009-06-24 16:32:19 -05:00 committed by Alexandre Julliard
parent 7c7f70a317
commit 78c3aa78d2
1 changed files with 24 additions and 2 deletions

View File

@ -155,11 +155,33 @@ static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, double *pDpiY)
{
switch (bih->bV5Size)
{
case sizeof(BITMAPCOREHEADER):
*pDpiX = 96.0;
*pDpiY = 96.0;
return S_OK;
case sizeof(BITMAPCOREHEADER2):
case sizeof(BITMAPINFOHEADER):
case sizeof(BITMAPV4HEADER):
case sizeof(BITMAPV5HEADER):
*pDpiX = bih->bV5XPelsPerMeter * 0.0254;
*pDpiY = bih->bV5YPelsPerMeter * 0.0254;
return S_OK;
default:
return E_FAIL;
}
}
static HRESULT WINAPI BmpFrameDecode_GetResolution(IWICBitmapFrameDecode *iface, static HRESULT WINAPI BmpFrameDecode_GetResolution(IWICBitmapFrameDecode *iface,
double *pDpiX, double *pDpiY) double *pDpiX, double *pDpiY)
{ {
FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY); BmpFrameDecode *This = (BmpFrameDecode*)iface;
return E_NOTIMPL; TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
return BmpHeader_GetResolution(&This->bih, pDpiX, pDpiY);
} }
static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,