Vincent Povirk : windowscodecs: Add stub GIF decoder.

Alexandre Julliard julliard at winehq.org
Tue Aug 18 10:02:01 CDT 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Aug 17 09:45:28 2009 -0500

windowscodecs: Add stub GIF decoder.

---

 dlls/windowscodecs/Makefile.in         |    1 +
 dlls/windowscodecs/clsfactory.c        |    1 +
 dlls/windowscodecs/gifformat.c         |  203 ++++++++++++++++++++++++++++++++
 dlls/windowscodecs/regsvr.c            |    6 +
 dlls/windowscodecs/wincodecs_private.h |    1 +
 5 files changed, 212 insertions(+), 0 deletions(-)

diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in
index aaf2c94..c347496 100644
--- a/dlls/windowscodecs/Makefile.in
+++ b/dlls/windowscodecs/Makefile.in
@@ -11,6 +11,7 @@ C_SRCS = \
 	bmpencode.c \
 	clsfactory.c \
 	converter.c \
+	gifformat.c \
 	imgfactory.c \
 	info.c \
 	main.c \
diff --git a/dlls/windowscodecs/clsfactory.c b/dlls/windowscodecs/clsfactory.c
index 3adb99b..876cbbb 100644
--- a/dlls/windowscodecs/clsfactory.c
+++ b/dlls/windowscodecs/clsfactory.c
@@ -45,6 +45,7 @@ static classinfo wic_classes[] = {
     {&CLSID_WICImagingFactory, ImagingFactory_CreateInstance},
     {&CLSID_WICBmpDecoder, BmpDecoder_CreateInstance},
     {&CLSID_WICBmpEncoder, BmpEncoder_CreateInstance},
+    {&CLSID_WICGifDecoder, GifDecoder_CreateInstance},
     {&CLSID_WICDefaultFormatConverter, FormatConverter_CreateInstance},
     {0}};
 
diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
new file mode 100644
index 0000000..0ecbd3c
--- /dev/null
+++ b/dlls/windowscodecs/gifformat.c
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2009 Vincent Povirk for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "wincodec.h"
+
+#include "wincodecs_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
+
+typedef struct {
+    const IWICBitmapDecoderVtbl *lpVtbl;
+    LONG ref;
+} GifDecoder;
+
+static HRESULT WINAPI GifDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid,
+    void **ppv)
+{
+    GifDecoder *This = (GifDecoder*)iface;
+    TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
+
+    if (!ppv) return E_INVALIDARG;
+
+    if (IsEqualIID(&IID_IUnknown, iid) || IsEqualIID(&IID_IWICBitmapDecoder, iid))
+    {
+        *ppv = This;
+    }
+    else
+    {
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI GifDecoder_AddRef(IWICBitmapDecoder *iface)
+{
+    GifDecoder *This = (GifDecoder*)iface;
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) refcount=%u\n", iface, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI GifDecoder_Release(IWICBitmapDecoder *iface)
+{
+    GifDecoder *This = (GifDecoder*)iface;
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) refcount=%u\n", iface, ref);
+
+    if (ref == 0)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI GifDecoder_QueryCapability(IWICBitmapDecoder *iface, IStream *pIStream,
+    DWORD *pdwCapability)
+{
+    FIXME("(%p,%p,%p): stub\n", iface, pIStream, pdwCapability);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI GifDecoder_Initialize(IWICBitmapDecoder *iface, IStream *pIStream,
+    WICDecodeOptions cacheOptions)
+{
+    FIXME("(%p,%p,%x): stub\n", iface, pIStream, cacheOptions);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI GifDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
+    GUID *pguidContainerFormat)
+{
+    FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI GifDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
+    IWICBitmapDecoderInfo **ppIDecoderInfo)
+{
+    FIXME("(%p,%p): stub\n", iface, ppIDecoderInfo);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface,
+    IWICPalette *pIPalette)
+{
+    TRACE("(%p,%p)\n", iface, pIPalette);
+    return WINCODEC_ERR_PALETTEUNAVAILABLE;
+}
+
+static HRESULT WINAPI GifDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
+    IWICMetadataQueryReader **ppIMetadataQueryReader)
+{
+    TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
+    return WINCODEC_ERR_UNSUPPORTEDOPERATION;
+}
+
+static HRESULT WINAPI GifDecoder_GetPreview(IWICBitmapDecoder *iface,
+    IWICBitmapSource **ppIBitmapSource)
+{
+    TRACE("(%p,%p)\n", iface, ppIBitmapSource);
+    return WINCODEC_ERR_UNSUPPORTEDOPERATION;
+}
+
+static HRESULT WINAPI GifDecoder_GetColorContexts(IWICBitmapDecoder *iface,
+    UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount)
+{
+    TRACE("(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount);
+    return WINCODEC_ERR_UNSUPPORTEDOPERATION;
+}
+
+static HRESULT WINAPI GifDecoder_GetThumbnail(IWICBitmapDecoder *iface,
+    IWICBitmapSource **ppIThumbnail)
+{
+    TRACE("(%p,%p)\n", iface, ppIThumbnail);
+    return WINCODEC_ERR_CODECNOTHUMBNAIL;
+}
+
+static HRESULT WINAPI GifDecoder_GetFrameCount(IWICBitmapDecoder *iface,
+    UINT *pCount)
+{
+    FIXME("(%p,%p): stub\n", iface, pCount);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI GifDecoder_GetFrame(IWICBitmapDecoder *iface,
+    UINT index, IWICBitmapFrameDecode **ppIBitmapFrame)
+{
+    FIXME("(%p,%u,%p): stub\n", iface, index, ppIBitmapFrame);
+    return E_NOTIMPL;
+}
+
+static const IWICBitmapDecoderVtbl GifDecoder_Vtbl = {
+    GifDecoder_QueryInterface,
+    GifDecoder_AddRef,
+    GifDecoder_Release,
+    GifDecoder_QueryCapability,
+    GifDecoder_Initialize,
+    GifDecoder_GetContainerFormat,
+    GifDecoder_GetDecoderInfo,
+    GifDecoder_CopyPalette,
+    GifDecoder_GetMetadataQueryReader,
+    GifDecoder_GetPreview,
+    GifDecoder_GetColorContexts,
+    GifDecoder_GetThumbnail,
+    GifDecoder_GetFrameCount,
+    GifDecoder_GetFrame
+};
+
+HRESULT GifDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
+{
+    GifDecoder *This;
+    HRESULT ret;
+
+    TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
+
+    *ppv = NULL;
+
+    if (pUnkOuter) return CLASS_E_NOAGGREGATION;
+
+    This = HeapAlloc(GetProcessHeap(), 0, sizeof(GifDecoder));
+    if (!This) return E_OUTOFMEMORY;
+
+    This->lpVtbl = &GifDecoder_Vtbl;
+    This->ref = 1;
+
+    ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv);
+    IUnknown_Release((IUnknown*)This);
+
+    return ret;
+}
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index 4191366..8e3328a 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -741,6 +741,12 @@ static struct regsvr_coclass const coclass_list[] = {
 	"windowscodecs.dll",
 	"Apartment"
     },
+    {   &CLSID_WICGifDecoder,
+	"WIC GIF Decoder",
+	NULL,
+	"windowscodecs.dll",
+	"Apartment"
+    },
     {   &CLSID_WICDefaultFormatConverter,
 	"WIC Default Format Converter",
 	NULL,
diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h
index 70e3c16..6dcd47e 100644
--- a/dlls/windowscodecs/wincodecs_private.h
+++ b/dlls/windowscodecs/wincodecs_private.h
@@ -23,6 +23,7 @@ extern HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID riid,
 extern HRESULT ImagingFactory_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv);
 extern HRESULT BmpDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv);
 extern HRESULT BmpEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
+extern HRESULT GifDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv);
 
 extern HRESULT PaletteImpl_Create(IWICPalette **palette);
 




More information about the wine-cvs mailing list