Vincent Povirk : windowscodecs: Implement IsBlackWhite and IsGrayscale for palettes.

Alexandre Julliard julliard at winehq.org
Fri Jul 3 09:31:12 CDT 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Jul  2 17:44:31 2009 -0500

windowscodecs: Implement IsBlackWhite and IsGrayscale for palettes.

---

 dlls/windowscodecs/palette.c |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/dlls/windowscodecs/palette.c b/dlls/windowscodecs/palette.c
index a3d67aa..ccf1176 100644
--- a/dlls/windowscodecs/palette.c
+++ b/dlls/windowscodecs/palette.c
@@ -186,14 +186,41 @@ static HRESULT WINAPI PaletteImpl_GetColors(IWICPalette *iface, UINT colorCount,
 
 static HRESULT WINAPI PaletteImpl_IsBlackWhite(IWICPalette *iface, BOOL *pfIsBlackWhite)
 {
-    FIXME("(%p,%p): stub\n", iface, pfIsBlackWhite);
-    return E_NOTIMPL;
+    PaletteImpl *This = (PaletteImpl*)iface;
+
+    TRACE("(%p,%p)\n", iface, pfIsBlackWhite);
+
+    if (!pfIsBlackWhite) return E_INVALIDARG;
+
+    if (This->type == WICBitmapPaletteTypeFixedBW)
+        *pfIsBlackWhite = TRUE;
+    else
+        *pfIsBlackWhite = FALSE;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI PaletteImpl_IsGrayscale(IWICPalette *iface, BOOL *pfIsGrayscale)
 {
-    FIXME("(%p,%p): stub\n", iface, pfIsGrayscale);
-    return E_NOTIMPL;
+    PaletteImpl *This = (PaletteImpl*)iface;
+
+    TRACE("(%p,%p)\n", iface, pfIsGrayscale);
+
+    if (!pfIsGrayscale) return E_INVALIDARG;
+
+    switch(This->type)
+    {
+        case WICBitmapPaletteTypeFixedBW:
+        case WICBitmapPaletteTypeFixedGray4:
+        case WICBitmapPaletteTypeFixedGray16:
+        case WICBitmapPaletteTypeFixedGray256:
+            *pfIsGrayscale = TRUE;
+            break;
+        default:
+            *pfIsGrayscale = FALSE;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI PaletteImpl_HasAlpha(IWICPalette *iface, BOOL *pfHasAlpha)




More information about the wine-cvs mailing list