mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
windowscodecs: BMP decoder should always return valid image resolution.
This commit is contained in:
parent
01ab797b64
commit
8d72c2771d
2 changed files with 21 additions and 10 deletions
|
@ -163,22 +163,35 @@ static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface
|
|||
|
||||
static HRESULT BmpHeader_GetResolution(BITMAPV5HEADER *bih, double *pDpiX, double *pDpiY)
|
||||
{
|
||||
LONG resx = 0, resy = 0;
|
||||
|
||||
switch (bih->bV5Size)
|
||||
{
|
||||
default:
|
||||
case sizeof(BITMAPCOREHEADER):
|
||||
*pDpiX = 96.0;
|
||||
*pDpiY = 96.0;
|
||||
return S_OK;
|
||||
break;
|
||||
|
||||
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;
|
||||
resx = bih->bV5XPelsPerMeter;
|
||||
resy = bih->bV5YPelsPerMeter;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!resx || !resy)
|
||||
{
|
||||
*pDpiX = 96.0;
|
||||
*pDpiY = 96.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pDpiX = resx * 0.0254;
|
||||
*pDpiY = resy * 0.0254;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BmpFrameDecode_GetResolution(IWICBitmapFrameDecode *iface,
|
||||
|
|
|
@ -138,9 +138,7 @@ static void test_decode_24bpp(void)
|
|||
|
||||
hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
|
||||
ok(SUCCEEDED(hr), "GetResolution failed, hr=%x\n", hr);
|
||||
todo_wine
|
||||
ok(dpiX == 96.0, "expected dpiX=96.0, got %f\n", dpiX);
|
||||
todo_wine
|
||||
ok(dpiY == 96.0, "expected dpiY=96.0, got %f\n", dpiY);
|
||||
|
||||
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
|
||||
|
|
Loading…
Reference in a new issue