[7/9] windowscodecs: implement GetSize for BMP decoder

Vincent Povirk madewokherd+8cd9 at gmail.com
Sat Jun 27 20:51:15 CDT 2009


Vincent Povirk
-------------- next part --------------
From 1da24ace91d90fbdf84f27a7a3e95afb619047fa Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 24 Jun 2009 16:20:29 -0500
Subject: [PATCH 7/9] windowscodecs: implement GetSize for BMP decoder

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

diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c
index 1c96261..f30e316 100644
--- a/dlls/windowscodecs/bmpdecode.c
+++ b/dlls/windowscodecs/bmpdecode.c
@@ -116,11 +116,36 @@ static ULONG WINAPI BmpFrameDecode_Release(IWICBitmapFrameDecode *iface)
     return ref;
 }
 
+static HRESULT BmpHeader_GetSize(BITMAPV5HEADER *bih, UINT *puiWidth, UINT *puiHeight)
+{
+    switch (bih->bV5Size)
+    {
+    case sizeof(BITMAPCOREHEADER):
+    {
+        BITMAPCOREHEADER *bch = (BITMAPCOREHEADER*)bih;
+        *puiWidth = bch->bcWidth;
+        *puiHeight = bch->bcHeight;
+        return S_OK;
+    }
+    case sizeof(BITMAPCOREHEADER2):
+    case sizeof(BITMAPINFOHEADER):
+    case sizeof(BITMAPV4HEADER):
+    case sizeof(BITMAPV5HEADER):
+        *puiWidth = bih->bV5Width;
+        *puiHeight = bih->bV5Height;
+        return S_OK;
+    default:
+        return E_FAIL;
+    }
+}
+
 static HRESULT WINAPI BmpFrameDecode_GetSize(IWICBitmapFrameDecode *iface,
     UINT *puiWidth, UINT *puiHeight)
 {
-    FIXME("(%p,%p,%p): stub\n", iface, puiWidth, puiHeight);
-    return E_NOTIMPL;
+    BmpFrameDecode *This = (BmpFrameDecode*)iface;
+    TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
+
+    return BmpHeader_GetSize(&This->bih, puiWidth, puiHeight);
 }
 
 static HRESULT WINAPI BmpFrameDecode_GetPixelFormat(IWICBitmapFrameDecode *iface,
-- 
1.6.3.1


More information about the wine-patches mailing list