windowscodecs: Make JPEG decoder fallback to 96 dpi resolution for density_unit == 0 case.

Dmitry Timoshkov dmitry at baikal.ru
Mon Mar 18 00:22:13 CDT 2013


This patch fixes regression reported in the bug 33228.
---
 dlls/windowscodecs/jpegformat.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index 6f2653d..c742f78 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -548,16 +548,23 @@ static HRESULT WINAPI JpegDecoder_Frame_GetResolution(IWICBitmapFrameDecode *ifa
 
     EnterCriticalSection(&This->lock);
 
-    if (This->cinfo.density_unit == 2) /* pixels per centimeter */
+    switch (This->cinfo.density_unit)
     {
+    case 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 */
+        break;
+
+    case 1: /* pixels per inch */
         *pDpiX = This->cinfo.X_density;
         *pDpiY = This->cinfo.Y_density;
+        break;
+
+    case 0: /* unknown */
+    default:
+        *pDpiX = 96.0;
+        *pDpiY = 96.0;
+        break;
     }
 
     LeaveCriticalSection(&This->lock);
-- 
1.8.2




More information about the wine-patches mailing list