Vincent Povirk : windowscodecs: Implement GetResolution for BMP decoder.

Alexandre Julliard julliard at winehq.org
Mon Jun 29 09:17:48 CDT 2009


Module: wine
Branch: master
Commit: 78c3aa78d2c90e411778c42839b6a424df9f22ba
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=78c3aa78d2c90e411778c42839b6a424df9f22ba

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Jun 24 16:32:19 2009 -0500

windowscodecs: Implement GetResolution for BMP decoder.

---

 dlls/windowscodecs/bmpdecode.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c
index 7db5dfb..afe4881 100644
--- a/dlls/windowscodecs/bmpdecode.c
+++ b/dlls/windowscodecs/bmpdecode.c
@@ -155,11 +155,33 @@ static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface
     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,
     double *pDpiX, double *pDpiY)
 {
-    FIXME("(%p,%p,%p): stub\n", iface, pDpiX, pDpiY);
-    return E_NOTIMPL;
+    BmpFrameDecode *This = (BmpFrameDecode*)iface;
+    TRACE("(%p,%p,%p)\n", iface, pDpiX, pDpiY);
+
+    return BmpHeader_GetResolution(&This->bih, pDpiX, pDpiY);
 }
 
 static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,




More information about the wine-cvs mailing list