From b86fab9f84f16af403cc005ebf5a1f11e84885d1 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 27 Jul 2011 16:29:53 -0500 Subject: [PATCH 5/5] windowscodecs: Implement IcoFrameDecode_GetResolution. --- dlls/windowscodecs/icoformat.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/icoformat.c b/dlls/windowscodecs/icoformat.c index fcb5d49..b9e7c61 100644 --- a/dlls/windowscodecs/icoformat.c +++ b/dlls/windowscodecs/icoformat.c @@ -69,6 +69,7 @@ typedef struct { IWICBitmapFrameDecode IWICBitmapFrameDecode_iface; LONG ref; UINT width, height; + double dpiX, dpiY; BYTE *bits; } IcoFrameDecode; @@ -155,8 +156,14 @@ static HRESULT WINAPI IcoFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface static HRESULT WINAPI IcoFrameDecode_GetResolution(IWICBitmapFrameDecode *iface, double *pDpiX, double *pDpiY) { - FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY); - return E_NOTIMPL; + IcoFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface); + + *pDpiX = This->dpiX; + *pDpiY = This->dpiY; + + TRACE("(%p) -> (%f,%f)\n", iface, *pDpiX, *pDpiY); + + return S_OK; } static HRESULT WINAPI IcoFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, @@ -276,6 +283,9 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result) IWICBitmapSource_Release(source); } + if (SUCCEEDED(hr)) + hr = IWICBitmapFrameDecode_GetResolution(source, &result->dpiX, &result->dpiY); + IWICBitmapFrameDecode_Release(framedecode); } @@ -402,6 +412,9 @@ static HRESULT ReadIcoPng(IStream *stream, IcoFrameDecode *result) hr = IWICBitmapFrameDecode_GetSize(sourceFrame, &result->width, &result->height); if (FAILED(hr)) goto end; + hr = IWICBitmapFrameDecode_GetResolution(sourceFrame, &result->dpiX, &result->dpiY); + if (FAILED(hr)) + goto end; result->bits = HeapAlloc(GetProcessHeap(), 0, 4 * result->width * result->height); if (result->bits == NULL) { -- 1.7.1