[2/3] windowscodecs: Implement JpegDecoder_Frame_GetResolution.
Vincent Povirk
madewokherd at gmail.com
Wed Apr 18 08:53:32 CDT 2012
-------------- next part --------------
From 7ab1f4cf794363ea8c864501e95ea7d43b2f8497 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 11 Apr 2012 17:22:43 -0500
Subject: [PATCH 2/3] windowscodecs: Implement
JpegDecoder_Frame_GetResolution.
---
dlls/windowscodecs/jpegformat.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index d15dabf..53d7ec4 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -528,8 +528,27 @@ static HRESULT WINAPI JpegDecoder_Frame_GetPixelFormat(IWICBitmapFrameDecode *if
static HRESULT WINAPI JpegDecoder_Frame_GetResolution(IWICBitmapFrameDecode *iface,
double *pDpiX, double *pDpiY)
{
- FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
- return E_NOTIMPL;
+ JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
+
+ EnterCriticalSection(&This->lock);
+
+ if (This->cinfo.density_unit == 2) /* pixels per centimeter */
+ {
+ *pDpiX = This->cinfo.X_density * 2.54;
+ *pDpiY = This->cinfo.Y_density * 2.54;
+ }
+ else
+ {
+ /* 1 = pixels per inch, 0 = unknown */
+ *pDpiX = This->cinfo.X_density;
+ *pDpiY = This->cinfo.Y_density;
+ }
+
+ LeaveCriticalSection(&This->lock);
+
+ TRACE("(%p)->(%0.2f,%0.2f)\n", iface, *pDpiX, *pDpiY);
+
+ return S_OK;
}
static HRESULT WINAPI JpegDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
--
1.7.9.1
More information about the wine-patches
mailing list