[1/5] windowscodecs: Implement PixelFormatInfo_GetBitsPerPixel.

Vincent Povirk madewokherd at gmail.com
Thu Jun 21 10:06:51 CDT 2012


-------------- next part --------------
From e5de341b990be3bb2c9c9016f3c11fe3681620cc Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Mon, 16 Apr 2012 15:40:35 -0500
Subject: [PATCH 01/17] windowscodecs: Implement
 PixelFormatInfo_GetBitsPerPixel.

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

diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
index 5b81702..593a89f 100644
--- a/dlls/windowscodecs/info.c
+++ b/dlls/windowscodecs/info.c
@@ -46,6 +46,7 @@ static const WCHAR containerformat_valuename[] = {'C','o','n','t','a','i','n','e
 static const WCHAR metadataformat_valuename[] = {'M','e','t','a','d','a','t','a','F','o','r','m','a','t',0};
 static const WCHAR vendor_valuename[] = {'V','e','n','d','o','r',0};
 static const WCHAR version_valuename[] = {'V','e','r','s','i','o','n',0};
+static const WCHAR bitsperpixel_valuename[] = {'B','i','t','L','e','n','g','t','h',0};
 
 static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value,
     UINT buffer_size, WCHAR *buffer, UINT *actual_size)
@@ -106,6 +107,27 @@ static HRESULT ComponentInfo_GetGUIDValue(HKEY classkey, LPCWSTR value,
     return hr;
 }
 
+static HRESULT ComponentInfo_GetDWORDValue(HKEY classkey, LPCWSTR value,
+    DWORD *result)
+{
+    LONG ret;
+    DWORD cbdata = sizeof(DWORD);
+
+    if (!result)
+        return E_INVALIDARG;
+
+    ret = RegGetValueW(classkey, NULL, value, RRF_RT_DWORD, NULL,
+        result, &cbdata);
+
+    if (ret == ERROR_FILE_NOT_FOUND)
+    {
+        *result = 0;
+        return S_OK;
+    }
+
+    return HRESULT_FROM_WIN32(ret);
+}
+
 typedef struct {
     IWICBitmapDecoderInfo IWICBitmapDecoderInfo_iface;
     LONG ref;
@@ -1231,8 +1253,11 @@ static HRESULT WINAPI PixelFormatInfo_GetColorContext(IWICPixelFormatInfo2 *ifac
 static HRESULT WINAPI PixelFormatInfo_GetBitsPerPixel(IWICPixelFormatInfo2 *iface,
     UINT *puiBitsPerPixel)
 {
-    FIXME("(%p,%p): stub\n", iface, puiBitsPerPixel);
-    return E_NOTIMPL;
+    PixelFormatInfo *This = impl_from_IWICPixelFormatInfo2(iface);
+
+    TRACE("(%p,%p)\n", iface, puiBitsPerPixel);
+
+    return ComponentInfo_GetDWORDValue(This->classkey, bitsperpixel_valuename, puiBitsPerPixel);
 }
 
 static HRESULT WINAPI PixelFormatInfo_GetChannelCount(IWICPixelFormatInfo2 *iface,
-- 
1.7.9.5


More information about the wine-devel mailing list