https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c3715ca58f21624199c9f5...
commit c3715ca58f21624199c9f507840e73731887951c Author: Amine Khaldi amine.khaldi@reactos.org AuthorDate: Sat Jan 20 13:50:46 2018 +0100 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Sat Jan 20 13:50:46 2018 +0100
[WINDOWSCODECS] Sync with Wine 3.0. CORE-14225 --- dll/win32/windowscodecs/CMakeLists.txt | 11 +- dll/win32/windowscodecs/bitmap.c | 214 +---- dll/win32/windowscodecs/bmpdecode.c | 2 +- dll/win32/windowscodecs/bmpencode.c | 80 +- dll/win32/windowscodecs/clsfactory.c | 1 - dll/win32/windowscodecs/converter.c | 296 +----- dll/win32/windowscodecs/gifformat.c | 1015 +------------------- dll/win32/windowscodecs/imgfactory.c | 115 +-- dll/win32/windowscodecs/info.c | 20 +- dll/win32/windowscodecs/jpegformat.c | 185 ++-- dll/win32/windowscodecs/metadatahandler.c | 47 +- dll/win32/windowscodecs/palette.c | 279 +----- dll/win32/windowscodecs/pngformat.c | 182 ++-- dll/win32/windowscodecs/regsvr.c | 113 +-- dll/win32/windowscodecs/scaler.c | 169 ---- dll/win32/windowscodecs/tiffformat.c | 320 +----- dll/win32/windowscodecs/wincodecs_private.h | 78 +- dll/win32/windowscodecs/windowscodecs.spec | 3 +- dll/win32/windowscodecs/windowscodecs_wincodec.idl | 7 - media/doc/README.WINE | 2 +- 20 files changed, 417 insertions(+), 2722 deletions(-)
diff --git a/dll/win32/windowscodecs/CMakeLists.txt b/dll/win32/windowscodecs/CMakeLists.txt index 227552a0b5..7ed058d112 100644 --- a/dll/win32/windowscodecs/CMakeLists.txt +++ b/dll/win32/windowscodecs/CMakeLists.txt @@ -23,6 +23,7 @@ spec2def(windowscodecs.dll windowscodecs.spec ADD_IMPORTLIB) add_rpcproxy_files(windowscodecs_wincodec.idl)
list(APPEND SOURCE + bitmap.c bmpdecode.c bmpencode.c clipper.c @@ -52,16 +53,6 @@ list(APPEND SOURCE ungif.c wincodecs_private.h)
-if(MSVC) - if(ARCH STREQUAL "i386") - list(APPEND SOURCE msvc-thiscall.c) - endif() - set_source_files_properties(bitmap.c PROPERTIES COMPILE_FLAGS "/FImsvc.h") - list(APPEND ADDITIONAL_SOURCE bitmap.c) -else() - list(APPEND SOURCE bitmap.c) -endif() - list(APPEND ADDITIONAL_SOURCE guid.c version.rc diff --git a/dll/win32/windowscodecs/bitmap.c b/dll/win32/windowscodecs/bitmap.c index 3d5a2bb496..dfd7dda89f 100644 --- a/dll/win32/windowscodecs/bitmap.c +++ b/dll/win32/windowscodecs/bitmap.c @@ -31,7 +31,6 @@ typedef struct BitmapImpl { int palette_set; LONG lock; /* 0 if not locked, -1 if locked for writing, count if locked for reading */ BYTE *data; - BOOL is_section; /* TRUE if data is a section created by an application */ UINT width, height; UINT stride; UINT bpp; @@ -63,13 +62,10 @@ static inline BitmapImpl *impl_from_IMILUnknown1(IMILUnknown1 *iface) return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown1_iface); }
-#ifndef __REACTOS__ -/* This is currently unused */ static inline BitmapImpl *impl_from_IMILUnknown2(IMILUnknown2 *iface) { return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown2_iface); } -#endif
static inline BitmapLockImpl *impl_from_IWICBitmapLock(IWICBitmapLock *iface) { @@ -125,7 +121,6 @@ static HRESULT WINAPI BitmapLockImpl_QueryInterface(IWICBitmapLock *iface, REFII } else { - FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -239,14 +234,12 @@ static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid, { *ppv = &This->IWICBitmap_iface; } - else if (IsEqualIID(&IID_IMILBitmap, iid) || - IsEqualIID(&IID_IMILBitmapSource, iid)) + else if (IsEqualIID(&IID_IMILBitmapSource, iid)) { *ppv = &This->IMILBitmapSource_iface; } else { - FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -277,10 +270,7 @@ static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface) if (This->palette) IWICPalette_Release(This->palette); This->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->cs); - if (This->is_section) - UnmapViewOfFile(This->data); - else - HeapFree(GetProcessHeap(), 0, This->data); + HeapFree(GetProcessHeap(), 0, This->data); HeapFree(GetProcessHeap(), 0, This); }
@@ -475,22 +465,13 @@ static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REF if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) || - IsEqualIID(&IID_IMILBitmap, iid) || IsEqualIID(&IID_IMILBitmapSource, iid)) { IUnknown_AddRef(&This->IMILBitmapSource_iface); *ppv = &This->IMILBitmapSource_iface; return S_OK; } - else if (IsEqualIID(&IID_IWICBitmap, iid) || - IsEqualIID(&IID_IWICBitmapSource, iid)) - { - IUnknown_AddRef(&This->IWICBitmap_iface); - *ppv = &This->IWICBitmap_iface; - return S_OK; - }
- FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -511,7 +492,6 @@ static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface, UINT *width, UINT *height) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); - TRACE("(%p,%p,%p)\n", iface, width, height); return IWICBitmap_GetSize(&This->IWICBitmap_iface, width, height); }
@@ -565,7 +545,6 @@ static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface, } }
- TRACE("=> %u\n", *format); return S_OK; }
@@ -573,7 +552,6 @@ static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface, double *dpix, double *dpiy) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); - TRACE("(%p,%p,%p)\n", iface, dpix, dpiy); return IWICBitmap_GetResolution(&This->IWICBitmap_iface, dpix, dpiy); }
@@ -581,7 +559,6 @@ static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface, IWICPalette *palette) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); - TRACE("(%p,%p)\n", iface, palette); return IWICBitmap_CopyPalette(&This->IWICBitmap_iface, palette); }
@@ -589,11 +566,10 @@ static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface, const WICRect *rc, UINT stride, UINT size, BYTE *buffer) { BitmapImpl *This = impl_from_IMILBitmapSource(iface); - TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer); return IWICBitmap_CopyPixels(&This->IWICBitmap_iface, rc, stride, size, buffer); }
-static HRESULT WINAPI IMILBitmapImpl_unknown1(IMILBitmapSource *iface, void **ppv) +static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, void **ppv) { BitmapImpl *This = impl_from_IMILBitmapSource(iface);
@@ -601,46 +577,12 @@ static HRESULT WINAPI IMILBitmapImpl_unknown1(IMILBitmapSource *iface, void **pp
if (!ppv) return E_INVALIDARG;
- /* reference count is not incremented here */ + IUnknown_AddRef(&This->IMILUnknown1_iface); *ppv = &This->IMILUnknown1_iface;
return S_OK; }
-static HRESULT WINAPI IMILBitmapImpl_Lock(IMILBitmapSource *iface, const WICRect *rc, DWORD flags, IWICBitmapLock **lock) -{ - BitmapImpl *This = impl_from_IMILBitmapSource(iface); - TRACE("(%p,%p,%08x,%p)\n", iface, rc, flags, lock); - return IWICBitmap_Lock(&This->IWICBitmap_iface, rc, flags, lock); -} - -static HRESULT WINAPI IMILBitmapImpl_Unlock(IMILBitmapSource *iface, IWICBitmapLock *lock) -{ - TRACE("(%p,%p)\n", iface, lock); - IWICBitmapLock_Release(lock); - return S_OK; -} - -static HRESULT WINAPI IMILBitmapImpl_SetPalette(IMILBitmapSource *iface, IWICPalette *palette) -{ - BitmapImpl *This = impl_from_IMILBitmapSource(iface); - TRACE("(%p,%p)\n", iface, palette); - return IWICBitmap_SetPalette(&This->IWICBitmap_iface, palette); -} - -static HRESULT WINAPI IMILBitmapImpl_SetResolution(IMILBitmapSource *iface, double dpix, double dpiy) -{ - BitmapImpl *This = impl_from_IMILBitmapSource(iface); - TRACE("(%p,%f,%f)\n", iface, dpix, dpiy); - return IWICBitmap_SetResolution(&This->IWICBitmap_iface, dpix, dpiy); -} - -static HRESULT WINAPI IMILBitmapImpl_AddDirtyRect(IMILBitmapSource *iface, const WICRect *rc) -{ - FIXME("(%p,%p): stub\n", iface, rc); - return E_NOTIMPL; -} - static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = { IMILBitmapImpl_QueryInterface, @@ -651,20 +593,26 @@ static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = IMILBitmapImpl_GetResolution, IMILBitmapImpl_CopyPalette, IMILBitmapImpl_CopyPixels, - IMILBitmapImpl_unknown1, - IMILBitmapImpl_Lock, - IMILBitmapImpl_Unlock, - IMILBitmapImpl_SetPalette, - IMILBitmapImpl_SetResolution, - IMILBitmapImpl_AddDirtyRect + IMILBitmapImpl_UnknownMethod1, };
static HRESULT WINAPI IMILUnknown1Impl_QueryInterface(IMILUnknown1 *iface, REFIID iid, void **ppv) { - FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv); - *ppv = NULL; - return E_NOINTERFACE; + BitmapImpl *This = impl_from_IMILUnknown1(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid)) + { + IUnknown_AddRef(&This->IMILUnknown1_iface); + *ppv = iface; + return S_OK; + } + + return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); }
static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface) @@ -679,128 +627,66 @@ static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface) return IWICBitmap_Release(&This->IWICBitmap_iface); }
-DECLSPEC_HIDDEN void WINAPI IMILUnknown1Impl_unknown1(IMILUnknown1 *iface, void *arg) -{ - FIXME("(%p,%p): stub\n", iface, arg); -} - -static HRESULT WINAPI IMILUnknown1Impl_unknown2(IMILUnknown1 *iface, void *arg1, void *arg2) -{ - FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); - return E_NOTIMPL; -} - -DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown3(IMILUnknown1 *iface, void *arg) -{ - FIXME("(%p,%p): stub\n", iface, arg); - return E_NOTIMPL; -} - -static HRESULT WINAPI IMILUnknown1Impl_unknown4(IMILUnknown1 *iface, void *arg) -{ - FIXME("(%p,%p): stub\n", iface, arg); - return E_NOTIMPL; -} - -static HRESULT WINAPI IMILUnknown1Impl_unknown5(IMILUnknown1 *iface, void *arg) -{ - FIXME("(%p,%p): stub\n", iface, arg); - return E_NOTIMPL; -} - -static HRESULT WINAPI IMILUnknown1Impl_unknown6(IMILUnknown1 *iface, DWORD64 arg) -{ - FIXME("(%p,%s): stub\n", iface, wine_dbgstr_longlong(arg)); - return E_NOTIMPL; -} - -static HRESULT WINAPI IMILUnknown1Impl_unknown7(IMILUnknown1 *iface, void *arg) -{ - FIXME("(%p,%p): stub\n", iface, arg); - return E_NOTIMPL; -} - -DECLSPEC_HIDDEN HRESULT WINAPI IMILUnknown1Impl_unknown8(IMILUnknown1 *iface) -{ - FIXME("(%p): stub\n", iface); - return E_NOTIMPL; -} - -DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown1, 8) -DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown3, 8) -DEFINE_THISCALL_WRAPPER(IMILUnknown1Impl_unknown8, 4) - static const IMILUnknown1Vtbl IMILUnknown1Impl_Vtbl = { IMILUnknown1Impl_QueryInterface, IMILUnknown1Impl_AddRef, IMILUnknown1Impl_Release, - THISCALL(IMILUnknown1Impl_unknown1), - IMILUnknown1Impl_unknown2, - THISCALL(IMILUnknown1Impl_unknown3), - IMILUnknown1Impl_unknown4, - IMILUnknown1Impl_unknown5, - IMILUnknown1Impl_unknown6, - IMILUnknown1Impl_unknown7, - THISCALL(IMILUnknown1Impl_unknown8) };
static HRESULT WINAPI IMILUnknown2Impl_QueryInterface(IMILUnknown2 *iface, REFIID iid, void **ppv) { - FIXME("(%p,%s,%p): stub\n", iface, debugstr_guid(iid), ppv); - *ppv = NULL; - return E_NOINTERFACE; + BitmapImpl *This = impl_from_IMILUnknown2(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid)) + { + IUnknown_AddRef(&This->IMILUnknown2_iface); + *ppv = iface; + return S_OK; + } + + return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); }
static ULONG WINAPI IMILUnknown2Impl_AddRef(IMILUnknown2 *iface) { - FIXME("(%p): stub\n", iface); - return 0; + BitmapImpl *This = impl_from_IMILUnknown2(iface); + return IWICBitmap_AddRef(&This->IWICBitmap_iface); }
static ULONG WINAPI IMILUnknown2Impl_Release(IMILUnknown2 *iface) { - FIXME("(%p): stub\n", iface); - return 0; -} - -static HRESULT WINAPI IMILUnknown2Impl_unknown1(IMILUnknown2 *iface, void *arg1, void **arg2) -{ - FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); - if (arg2) *arg2 = NULL; - return E_NOTIMPL; + BitmapImpl *This = impl_from_IMILUnknown2(iface); + return IWICBitmap_Release(&This->IWICBitmap_iface); }
-static HRESULT WINAPI IMILUnknown2Impl_unknown2(IMILUnknown2 *iface, void *arg1, void *arg2) +static HRESULT WINAPI IMILUnknown2Impl_UnknownMethod1(IMILUnknown2 *iface, void *arg1, void *arg2) { FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); return E_NOTIMPL; }
-static HRESULT WINAPI IMILUnknown2Impl_unknown3(IMILUnknown2 *iface, void *arg1) -{ - FIXME("(%p,%p): stub\n", iface, arg1); - return E_NOTIMPL; -} - static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = { IMILUnknown2Impl_QueryInterface, IMILUnknown2Impl_AddRef, IMILUnknown2Impl_Release, - IMILUnknown2Impl_unknown1, - IMILUnknown2Impl_unknown2, - IMILUnknown2Impl_unknown3 + IMILUnknown2Impl_UnknownMethod1, };
HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, - UINT stride, UINT datasize, BYTE *data, + UINT stride, UINT datasize, BYTE *bits, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap) { HRESULT hr; BitmapImpl *This; + BYTE *data; UINT bpp;
hr = get_pixelformat_bpp(pixelFormat, &bpp); @@ -813,20 +699,14 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, if (stride < ((bpp*uiWidth)+7)/8) return E_INVALIDARG;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl)); - if (!This) return E_OUTOFMEMORY; - - if (!data) + data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize); + if (!This || !data) { - data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize); - if (!data) - { - HeapFree(GetProcessHeap(), 0, This); - return E_OUTOFMEMORY; - } - This->is_section = FALSE; + HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, data); + return E_OUTOFMEMORY; } - else - This->is_section = TRUE; + if (bits) memcpy(data, bits, datasize);
This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl; This->IMILBitmapSource_iface.lpVtbl = &IMILBitmapImpl_Vtbl; diff --git a/dll/win32/windowscodecs/bmpdecode.c b/dll/win32/windowscodecs/bmpdecode.c index 395f71f1d8..5039694a76 100644 --- a/dll/win32/windowscodecs/bmpdecode.c +++ b/dll/win32/windowscodecs/bmpdecode.c @@ -256,7 +256,7 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, if (This->bih.bV5ClrUsed == 0) count = 1 << This->bih.bV5BitCount; else - count = min(This->bih.bV5ClrUsed, 1 << This->bih.bV5BitCount); + count = This->bih.bV5ClrUsed;
tablesize = sizeof(WICColor) * count; wiccolors = HeapAlloc(GetProcessHeap(), 0, tablesize); diff --git a/dll/win32/windowscodecs/bmpencode.c b/dll/win32/windowscodecs/bmpencode.c index 5bc043a4db..e339324015 100644 --- a/dll/win32/windowscodecs/bmpencode.c +++ b/dll/win32/windowscodecs/bmpencode.c @@ -1,6 +1,5 @@ /* * Copyright 2009 Vincent Povirk for CodeWeavers - * Copyright 2016 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,7 +23,6 @@ struct bmp_pixelformat { const WICPixelFormatGUID *guid; UINT bpp; - UINT colors; /* palette size */ DWORD compression; DWORD redmask; DWORD greenmask; @@ -33,18 +31,13 @@ struct bmp_pixelformat { };
static const struct bmp_pixelformat formats[] = { - {&GUID_WICPixelFormat24bppBGR, 24, 0, BI_RGB}, - {&GUID_WICPixelFormatBlackWhite, 1, 2, BI_RGB}, - {&GUID_WICPixelFormat1bppIndexed, 1, 2, BI_RGB}, - {&GUID_WICPixelFormat2bppIndexed, 2, 4, BI_RGB}, - {&GUID_WICPixelFormat4bppIndexed, 4, 16, BI_RGB}, - {&GUID_WICPixelFormat8bppIndexed, 8, 256, BI_RGB}, - {&GUID_WICPixelFormat16bppBGR555, 16, 0, BI_RGB}, - {&GUID_WICPixelFormat16bppBGR565, 16, 0, BI_BITFIELDS, 0xf800, 0x7e0, 0x1f, 0}, - {&GUID_WICPixelFormat32bppBGR, 32, 0, BI_RGB}, + {&GUID_WICPixelFormat24bppBGR, 24, BI_RGB}, + {&GUID_WICPixelFormat16bppBGR555, 16, BI_RGB}, + {&GUID_WICPixelFormat16bppBGR565, 16, BI_BITFIELDS, 0xf800, 0x7e0, 0x1f, 0}, + {&GUID_WICPixelFormat32bppBGR, 32, BI_RGB}, #if 0 /* Windows doesn't seem to support this one. */ - {&GUID_WICPixelFormat32bppBGRA, 32, 0, BI_BITFIELDS, 0xff0000, 0xff00, 0xff, 0xff000000}, + {&GUID_WICPixelFormat32bppBGRA, 32, BI_BITFIELDS, 0xff0000, 0xff00, 0xff, 0xff000000}, #endif {NULL} }; @@ -172,13 +165,11 @@ static HRESULT WINAPI BmpFrameEncode_SetPixelFormat(IWICBitmapFrameEncode *iface
for (i=0; formats[i].guid; i++) { - if (IsEqualGUID(formats[i].guid, pPixelFormat)) + if (memcmp(formats[i].guid, pPixelFormat, sizeof(GUID)) == 0) break; }
if (!formats[i].guid) i = 0; - else if (IsEqualGUID(pPixelFormat, &GUID_WICPixelFormatBlackWhite)) - i = 2; /* GUID_WICPixelFormat1bppIndexed */
This->format = &formats[i]; memcpy(pPixelFormat, This->format->guid, sizeof(GUID)); @@ -197,7 +188,6 @@ static HRESULT WINAPI BmpFrameEncode_SetPalette(IWICBitmapFrameEncode *iface, IWICPalette *palette) { BmpFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr;
TRACE("(%p,%p)\n", iface, palette);
@@ -206,14 +196,7 @@ static HRESULT WINAPI BmpFrameEncode_SetPalette(IWICBitmapFrameEncode *iface, if (!This->initialized) return WINCODEC_ERR_NOTINITIALIZED;
- hr = IWICPalette_GetColors(palette, 256, This->palette, &This->colors); - if (hr == S_OK) - { - UINT i; - for (i = 0; i < This->colors; i++) - This->palette[i] |= 0xff000000; /* BMP palette has no alpha */ - } - return hr; + return IWICPalette_GetColors(palette, 256, This->palette, &This->colors); }
static HRESULT WINAPI BmpFrameEncode_SetThumbnail(IWICBitmapFrameEncode *iface, @@ -295,11 +278,10 @@ static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface) BmpFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); BITMAPFILEHEADER bfh; BITMAPV5HEADER bih; - UINT info_size, i; + UINT info_size; LARGE_INTEGER pos; ULONG byteswritten; HRESULT hr; - const BYTE *bits;
TRACE("(%p)\n", iface);
@@ -312,15 +294,15 @@ static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface)
bih.bV5Size = info_size = sizeof(BITMAPINFOHEADER); bih.bV5Width = This->width; - bih.bV5Height = This->height; /* bottom-top bitmap */ + bih.bV5Height = -This->height; /* top-down bitmap */ bih.bV5Planes = 1; bih.bV5BitCount = This->format->bpp; bih.bV5Compression = This->format->compression; bih.bV5SizeImage = This->stride*This->height; bih.bV5XPelsPerMeter = (This->xres+0.0127) / 0.0254; bih.bV5YPelsPerMeter = (This->yres+0.0127) / 0.0254; - bih.bV5ClrUsed = (This->format->bpp <= 8) ? This->colors : 0; - bih.bV5ClrImportant = bih.bV5ClrUsed; + bih.bV5ClrUsed = 0; + bih.bV5ClrImportant = 0;
if (This->format->compression == BI_BITFIELDS) { @@ -337,7 +319,6 @@ static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface)
bfh.bfSize = sizeof(BITMAPFILEHEADER) + info_size + bih.bV5SizeImage; bfh.bfOffBits = sizeof(BITMAPFILEHEADER) + info_size; - bfh.bfOffBits += bih.bV5ClrUsed * sizeof(WICColor);
pos.QuadPart = 0; hr = IStream_Seek(This->stream, pos, STREAM_SEEK_SET, NULL); @@ -351,23 +332,9 @@ static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface) if (FAILED(hr)) return hr; if (byteswritten != info_size) return E_FAIL;
- /* write the palette */ - if (This->format->colors) - { - hr = IStream_Write(This->stream, This->palette, This->colors * sizeof(WICColor), &byteswritten); - if (FAILED(hr)) return hr; - if (byteswritten != This->colors * sizeof(WICColor)) return E_FAIL; - } - - /* write the image bits as a bottom-top array */ - bits = This->bits + bih.bV5SizeImage; - for (i = 0; i < This->height; i++) - { - bits -= This->stride; - hr = IStream_Write(This->stream, bits, This->stride, &byteswritten); - if (FAILED(hr)) return hr; - if (byteswritten != This->stride) return E_FAIL; - } + hr = IStream_Write(This->stream, This->bits, bih.bV5SizeImage, &byteswritten); + if (FAILED(hr)) return hr; + if (byteswritten != bih.bV5SizeImage) return E_FAIL;
This->committed = TRUE;
@@ -480,22 +447,11 @@ static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI BmpEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info) +static HRESULT WINAPI BmpEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, + IWICBitmapEncoderInfo **ppIEncoderInfo) { - IWICComponentInfo *comp_info; - HRESULT hr; - - TRACE("%p,%p\n", iface, info); - - if (!info) return E_INVALIDARG; - - hr = CreateComponentInfo(&CLSID_WICBmpEncoder, &comp_info); - if (hr == S_OK) - { - hr = IWICComponentInfo_QueryInterface(comp_info, &IID_IWICBitmapEncoderInfo, (void **)info); - IWICComponentInfo_Release(comp_info); - } - return hr; + FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo); + return E_NOTIMPL; }
static HRESULT WINAPI BmpEncoder_SetColorContexts(IWICBitmapEncoder *iface, diff --git a/dll/win32/windowscodecs/clsfactory.c b/dll/win32/windowscodecs/clsfactory.c index 079ae762b8..2116ff9e8b 100644 --- a/dll/win32/windowscodecs/clsfactory.c +++ b/dll/win32/windowscodecs/clsfactory.c @@ -32,7 +32,6 @@ static const classinfo wic_classes[] = { {&CLSID_WICPngEncoder, PngEncoder_CreateInstance}, {&CLSID_WICBmpEncoder, BmpEncoder_CreateInstance}, {&CLSID_WICGifDecoder, GifDecoder_CreateInstance}, - {&CLSID_WICGifEncoder, GifEncoder_CreateInstance}, {&CLSID_WICIcoDecoder, IcoDecoder_CreateInstance}, {&CLSID_WICJpegDecoder, JpegDecoder_CreateInstance}, {&CLSID_WICJpegEncoder, JpegEncoder_CreateInstance}, diff --git a/dll/win32/windowscodecs/converter.c b/dll/win32/windowscodecs/converter.c index 3fca5b38f6..d6086b087a 100644 --- a/dll/win32/windowscodecs/converter.c +++ b/dll/win32/windowscodecs/converter.c @@ -40,11 +40,8 @@ enum pixelformat { format_24bppRGB, format_32bppGrayFloat, format_32bppBGR, - format_32bppRGB, format_32bppBGRA, - format_32bppRGBA, format_32bppPBGRA, - format_32bppPRGBA, format_48bppRGB, format_64bppRGBA, format_32bppCMYK, @@ -66,7 +63,7 @@ typedef struct FormatConverter { const struct pixelformatinfo *dst_format, *src_format; WICBitmapDitherType dither; double alpha_threshold; - IWICPalette *palette; + WICBitmapPaletteType palette_type; CRITICAL_SECTION lock; /* must be held when initialized */ } FormatConverter;
@@ -850,27 +847,6 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe } }
-static HRESULT copypixels_to_32bppRGBA(struct FormatConverter *This, const WICRect *prc, - UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) -{ - HRESULT hr; - - switch (source_format) - { - case format_32bppRGB: - case format_32bppRGBA: - case format_32bppPRGBA: - if (prc) - return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); - return S_OK; - default: - hr = copypixels_to_32bppBGRA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format); - if (SUCCEEDED(hr) && prc) - reverse_bgr8(4, pbBuffer, prc->Width, prc->Height, cbStride); - return hr; - } -} - static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) { @@ -887,22 +863,6 @@ static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRec } }
-static HRESULT copypixels_to_32bppRGB(struct FormatConverter *This, const WICRect *prc, - UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) -{ - switch (source_format) - { - case format_32bppRGB: - case format_32bppRGBA: - case format_32bppPRGBA: - if (prc) - return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); - return S_OK; - default: - return copypixels_to_32bppRGBA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format); - } -} - static HRESULT copypixels_to_32bppPBGRA(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) { @@ -936,39 +896,6 @@ static HRESULT copypixels_to_32bppPBGRA(struct FormatConverter *This, const WICR } }
-static HRESULT copypixels_to_32bppPRGBA(struct FormatConverter *This, const WICRect *prc, - UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) -{ - HRESULT hr; - - switch (source_format) - { - case format_32bppPRGBA: - if (prc) - return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); - return S_OK; - default: - hr = copypixels_to_32bppRGBA(This, prc, cbStride, cbBufferSize, pbBuffer, source_format); - if (SUCCEEDED(hr) && prc) - { - INT x, y; - - for (y=0; y<prc->Height; y++) - for (x=0; x<prc->Width; x++) - { - BYTE alpha = pbBuffer[cbStride*y+4*x+3]; - if (alpha != 255) - { - pbBuffer[cbStride*y+4*x] = pbBuffer[cbStride*y+4*x] * alpha / 255; - pbBuffer[cbStride*y+4*x+1] = pbBuffer[cbStride*y+4*x+1] * alpha / 255; - pbBuffer[cbStride*y+4*x+2] = pbBuffer[cbStride*y+4*x+2] * alpha / 255; - } - } - } - return hr; - } -} - static HRESULT copypixels_to_24bppBGR(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) { @@ -1074,48 +1001,6 @@ static HRESULT copypixels_to_24bppBGR(struct FormatConverter *This, const WICRec } return S_OK;
- case format_32bppCMYK: - if (prc) - { - BYTE *srcdata; - UINT srcstride, srcdatasize; - - srcstride = 4 * prc->Width; - srcdatasize = srcstride * prc->Height; - - srcdata = HeapAlloc(GetProcessHeap(), 0, srcdatasize); - if (!srcdata) return E_OUTOFMEMORY; - - hr = IWICBitmapSource_CopyPixels(This->source, prc, srcstride, srcdatasize, srcdata); - if (SUCCEEDED(hr)) - { - INT x, y; - BYTE *src = srcdata, *dst = pbBuffer; - - for (y = 0; y < prc->Height; y++) - { - BYTE *cmyk = src; - BYTE *bgr = dst; - - for (x = 0; x < prc->Width; x++) - { - BYTE c = cmyk[0], m = cmyk[1], y = cmyk[2], k = cmyk[3]; - bgr[0] = (255 - y) * (255 - k) / 255; /* B */ - bgr[1] = (255 - m) * (255 - k) / 255; /* G */ - bgr[2] = (255 - c) * (255 - k) / 255; /* R */ - cmyk += 4; - bgr += 3; - } - src += srcstride; - dst += cbStride; - } - } - - HeapFree(GetProcessHeap(), 0, srcdata); - return hr; - } - return S_OK; - default: FIXME("Unimplemented conversion path!\n"); return WINCODEC_ERR_UNSUPPORTEDOPERATION; @@ -1323,95 +1208,11 @@ static HRESULT copypixels_to_8bppGray(struct FormatConverter *This, const WICRec return hr; }
-static UINT rgb_to_palette_index(BYTE r, BYTE g, BYTE b, WICColor *colors, UINT count) -{ - UINT best_diff, best_index, i; - - best_diff = ~0; - best_index = 0; - - for (i = 0; i < count; i++) - { - BYTE pal_r, pal_g, pal_b; - DWORD diff_r, diff_g, diff_b, diff; - - pal_r = colors[i] >> 16; - pal_g = colors[i] >> 8; - pal_b = colors[i]; - - diff_r = r - pal_r; - diff_g = g - pal_g; - diff_b = b - pal_b; - - diff = diff_r * diff_r + diff_g * diff_g + diff_b * diff_b; - if (diff == 0) return i; - - if (diff < best_diff) - { - best_diff = diff; - best_index = i; - } - } - - return best_index; -} - -static HRESULT copypixels_to_8bppIndexed(struct FormatConverter *This, const WICRect *prc, - UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format) -{ - HRESULT hr; - BYTE *srcdata; - WICColor colors[256]; - UINT srcstride, srcdatasize, count; - - if (source_format == format_8bppIndexed) - { - if (prc) - return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer); - - return S_OK; - } - - if (!This->palette) return WINCODEC_ERR_WRONGSTATE; - - hr = IWICPalette_GetColors(This->palette, 256, colors, &count); - if (hr != S_OK) return hr; - - srcstride = 3 * prc->Width; - srcdatasize = srcstride * prc->Height; - - srcdata = HeapAlloc(GetProcessHeap(), 0, srcdatasize); - if (!srcdata) return E_OUTOFMEMORY; - - hr = copypixels_to_24bppBGR(This, prc, srcstride, srcdatasize, srcdata, source_format); - if (SUCCEEDED(hr) && prc) - { - INT x, y; - BYTE *src = srcdata, *dst = pbBuffer; - - for (y = 0; y < prc->Height; y++) - { - BYTE *bgr = src; - - for (x = 0; x < prc->Width; x++) - { - dst[x] = rgb_to_palette_index(bgr[2], bgr[1], bgr[0], colors, count); - bgr += 3; - } - src += srcstride; - dst += cbStride; - } - } - - HeapFree(GetProcessHeap(), 0, srcdata); - return hr; -} - static const struct pixelformatinfo supported_formats[] = { {format_1bppIndexed, &GUID_WICPixelFormat1bppIndexed, NULL}, {format_2bppIndexed, &GUID_WICPixelFormat2bppIndexed, NULL}, {format_4bppIndexed, &GUID_WICPixelFormat4bppIndexed, NULL}, - {format_8bppIndexed, &GUID_WICPixelFormat8bppIndexed, copypixels_to_8bppIndexed}, + {format_8bppIndexed, &GUID_WICPixelFormat8bppIndexed, NULL}, {format_BlackWhite, &GUID_WICPixelFormatBlackWhite, NULL}, {format_2bppGray, &GUID_WICPixelFormat2bppGray, NULL}, {format_4bppGray, &GUID_WICPixelFormat4bppGray, NULL}, @@ -1424,11 +1225,8 @@ static const struct pixelformatinfo supported_formats[] = { {format_24bppRGB, &GUID_WICPixelFormat24bppRGB, copypixels_to_24bppRGB}, {format_32bppGrayFloat, &GUID_WICPixelFormat32bppGrayFloat, copypixels_to_32bppGrayFloat}, {format_32bppBGR, &GUID_WICPixelFormat32bppBGR, copypixels_to_32bppBGR}, - {format_32bppRGB, &GUID_WICPixelFormat32bppRGB, copypixels_to_32bppRGB}, {format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA}, - {format_32bppRGBA, &GUID_WICPixelFormat32bppRGBA, copypixels_to_32bppRGBA}, {format_32bppPBGRA, &GUID_WICPixelFormat32bppPBGRA, copypixels_to_32bppPBGRA}, - {format_32bppPRGBA, &GUID_WICPixelFormat32bppPRGBA, copypixels_to_32bppPRGBA}, {format_48bppRGB, &GUID_WICPixelFormat48bppRGB, NULL}, {format_64bppRGBA, &GUID_WICPixelFormat64bppRGBA, NULL}, {format_32bppCMYK, &GUID_WICPixelFormat32bppCMYK, NULL}, @@ -1491,7 +1289,6 @@ static ULONG WINAPI FormatConverter_Release(IWICFormatConverter *iface) This->lock.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->lock); if (This->source) IWICBitmapSource_Release(This->source); - if (This->palette) IWICPalette_Release(This->palette); HeapFree(GetProcessHeap(), 0, This); }
@@ -1540,27 +1337,10 @@ static HRESULT WINAPI FormatConverter_GetResolution(IWICFormatConverter *iface, }
static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface, - IWICPalette *palette) + IWICPalette *pIPalette) { - FormatConverter *This = impl_from_IWICFormatConverter(iface); - - TRACE("(%p,%p)\n", iface, palette); - - if (!palette) return E_INVALIDARG; - if (!This->source) return WINCODEC_ERR_WRONGSTATE; - - if (!This->palette) - { - HRESULT hr; - UINT bpp; - - hr = get_pixelformat_bpp(This->dst_format->guid, &bpp); - if (hr != S_OK) return hr; - if (bpp <= 8) return WINCODEC_ERR_WRONGSTATE; - return IWICBitmapSource_CopyPalette(This->source, palette); - } - - return IWICPalette_InitializeFromPalette(palette, This->palette); + FIXME("(%p,%p): stub\n", iface, pIPalette); + return E_NOTIMPL; }
static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface, @@ -1589,59 +1369,23 @@ static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface, pbBuffer, This->src_format->format); } else - return WINCODEC_ERR_WRONGSTATE; + return WINCODEC_ERR_NOTINITIALIZED; }
static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface, - IWICBitmapSource *source, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither, - IWICPalette *palette, double alpha_threshold, WICBitmapPaletteType palette_type) + IWICBitmapSource *pISource, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither, + IWICPalette *pIPalette, double alphaThresholdPercent, WICBitmapPaletteType paletteTranslate) { FormatConverter *This = impl_from_IWICFormatConverter(iface); const struct pixelformatinfo *srcinfo, *dstinfo; + static INT fixme=0; GUID srcFormat; - HRESULT res; - - TRACE("(%p,%p,%s,%u,%p,%0.3f,%u)\n", iface, source, debugstr_guid(dstFormat), - dither, palette, alpha_threshold, palette_type); - - if (!palette) - { - UINT bpp; - res = get_pixelformat_bpp(dstFormat, &bpp); - if (res != S_OK) return res; - - res = PaletteImpl_Create(&palette); - if (res != S_OK) return res; - - switch (palette_type) - { - case WICBitmapPaletteTypeCustom: - IWICPalette_Release(palette); - palette = NULL; - if (bpp <= 8) return E_INVALIDARG; - break; - - case WICBitmapPaletteTypeMedianCut: - { - if (bpp <= 8) - res = IWICPalette_InitializeFromBitmap(palette, source, 1 << bpp, FALSE); - break; - } + HRESULT res=S_OK;
- default: - if (bpp <= 8) - res = IWICPalette_InitializePredefined(palette, palette_type, FALSE); - break; - } + TRACE("(%p,%p,%s,%u,%p,%0.1f,%u)\n", iface, pISource, debugstr_guid(dstFormat), + dither, pIPalette, alphaThresholdPercent, paletteTranslate);
- if (res != S_OK) - { - IWICPalette_Release(palette); - return res; - } - } - else - IWICPalette_AddRef(palette); + if (pIPalette && !fixme++) FIXME("ignoring palette\n");
EnterCriticalSection(&This->lock);
@@ -1651,7 +1395,7 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface, goto end; }
- res = IWICBitmapSource_GetPixelFormat(source, &srcFormat); + res = IWICBitmapSource_GetPixelFormat(pISource, &srcFormat); if (FAILED(res)) goto end;
srcinfo = get_formatinfo(&srcFormat); @@ -1672,13 +1416,13 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
if (dstinfo->copy_function) { - IWICBitmapSource_AddRef(source); + IWICBitmapSource_AddRef(pISource); This->src_format = srcinfo; This->dst_format = dstinfo; This->dither = dither; - This->alpha_threshold = alpha_threshold; - This->palette = palette; - This->source = source; + This->alpha_threshold = alphaThresholdPercent; + This->palette_type = paletteTranslate; + This->source = pISource; } else { @@ -1690,9 +1434,6 @@ end:
LeaveCriticalSection(&This->lock);
- if (res != S_OK && palette) - IWICPalette_Release(palette); - return res; }
@@ -1760,7 +1501,6 @@ HRESULT FormatConverter_CreateInstance(REFIID iid, void** ppv) This->IWICFormatConverter_iface.lpVtbl = &FormatConverter_Vtbl; This->ref = 1; This->source = NULL; - This->palette = NULL; InitializeCriticalSection(&This->lock); This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FormatConverter.lock");
diff --git a/dll/win32/windowscodecs/gifformat.c b/dll/win32/windowscodecs/gifformat.c index 3a023d4963..3bc3bac409 100644 --- a/dll/win32/windowscodecs/gifformat.c +++ b/dll/win32/windowscodecs/gifformat.c @@ -1,6 +1,6 @@ /* * Copyright 2009 Vincent Povirk for CodeWeavers - * Copyright 2012,2016 Dmitry Timoshkov + * Copyright 2012 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,40 +23,6 @@
#include "ungif.h"
-#include "pshpack1.h" - -struct logical_screen_descriptor -{ - char signature[6]; - USHORT width; - USHORT height; - BYTE packed; - /* global_color_table_flag : 1; - * color_resolution : 3; - * sort_flag : 1; - * global_color_table_size : 3; - */ - BYTE background_color_index; - BYTE pixel_aspect_ratio; -}; - -struct image_descriptor -{ - USHORT left; - USHORT top; - USHORT width; - USHORT height; - BYTE packed; - /* local_color_table_flag : 1; - * interlace_flag : 1; - * sort_flag : 1; - * reserved : 2; - * local_color_table_size : 3; - */ -}; - -#include "poppack.h" - static LPWSTR strdupAtoW(const char *src) { int len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); @@ -68,7 +34,22 @@ static LPWSTR strdupAtoW(const char *src) static HRESULT load_LSD_metadata(IStream *stream, const GUID *vendor, DWORD options, MetadataItem **items, DWORD *count) { - struct logical_screen_descriptor lsd_data; +#include "pshpack1.h" + struct logical_screen_descriptor + { + char signature[6]; + USHORT width; + USHORT height; + BYTE packed; + /* global_color_table_flag : 1; + * color_resolution : 3; + * sort_flag : 1; + * global_color_table_size : 3; + */ + BYTE background_color_index; + BYTE pixel_aspect_ratio; + } lsd_data; +#include "poppack.h" HRESULT hr; ULONG bytesread, i; MetadataItem *result; @@ -153,6 +134,23 @@ HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv) return MetadataReader_Create(&LSDReader_Vtbl, iid, ppv); }
+#include "pshpack1.h" +struct image_descriptor +{ + USHORT left; + USHORT top; + USHORT width; + USHORT height; + BYTE packed; + /* local_color_table_flag : 1; + * interlace_flag : 1; + * sort_flag : 1; + * reserved : 2; + * local_color_table_size : 3; + */ +}; +#include "poppack.h" + static HRESULT load_IMD_metadata(IStream *stream, const GUID *vendor, DWORD options, MetadataItem **items, DWORD *count) { @@ -1185,9 +1183,6 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet
TRACE("(%p,%p)\n", iface, palette);
- if (!This->gif) - return WINCODEC_ERR_WRONGSTATE; - cm = This->gif->SColorMap; if (cm) { @@ -1452,945 +1447,3 @@ HRESULT GifDecoder_CreateInstance(REFIID iid, void** ppv)
return ret; } - -typedef struct GifEncoder -{ - IWICBitmapEncoder IWICBitmapEncoder_iface; - LONG ref; - IStream *stream; - CRITICAL_SECTION lock; - BOOL initialized, info_written, committed; - UINT n_frames; - WICColor palette[256]; - UINT colors; -} GifEncoder; - -static inline GifEncoder *impl_from_IWICBitmapEncoder(IWICBitmapEncoder *iface) -{ - return CONTAINING_RECORD(iface, GifEncoder, IWICBitmapEncoder_iface); -} - -typedef struct GifFrameEncode -{ - IWICBitmapFrameEncode IWICBitmapFrameEncode_iface; - LONG ref; - GifEncoder *encoder; - BOOL initialized, interlace, committed; - UINT width, height, lines; - double xres, yres; - WICColor palette[256]; - UINT colors; - BYTE *image_data; -} GifFrameEncode; - -static inline GifFrameEncode *impl_from_IWICBitmapFrameEncode(IWICBitmapFrameEncode *iface) -{ - return CONTAINING_RECORD(iface, GifFrameEncode, IWICBitmapFrameEncode_iface); -} - -static HRESULT WINAPI GifFrameEncode_QueryInterface(IWICBitmapFrameEncode *iface, REFIID iid, void **ppv) -{ - TRACE("%p,%s,%p\n", iface, debugstr_guid(iid), ppv); - - if (!ppv) return E_INVALIDARG; - - if (IsEqualIID(&IID_IUnknown, iid) || - IsEqualIID(&IID_IWICBitmapFrameEncode, iid)) - { - IWICBitmapFrameEncode_AddRef(iface); - *ppv = iface; - return S_OK; - } - - *ppv = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI GifFrameEncode_AddRef(IWICBitmapFrameEncode *iface) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("%p -> %u\n", iface, ref); - return ref; -} - -static ULONG WINAPI GifFrameEncode_Release(IWICBitmapFrameEncode *iface) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("%p -> %u\n", iface, ref); - - if (!ref) - { - IWICBitmapEncoder_Release(&This->encoder->IWICBitmapEncoder_iface); - HeapFree(GetProcessHeap(), 0, This->image_data); - HeapFree(GetProcessHeap(), 0, This); - } - - return ref; -} - -static HRESULT WINAPI GifFrameEncode_Initialize(IWICBitmapFrameEncode *iface, IPropertyBag2 *options) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p,%p\n", iface, options); - - EnterCriticalSection(&This->encoder->lock); - - if (!This->initialized) - { - This->initialized = TRUE; - hr = S_OK; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->encoder->lock); - - return hr; -} - -static HRESULT WINAPI GifFrameEncode_SetSize(IWICBitmapFrameEncode *iface, UINT width, UINT height) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p,%u,%u\n", iface, width, height); - - if (!width || !height) return E_INVALIDARG; - - EnterCriticalSection(&This->encoder->lock); - - if (This->initialized) - { - HeapFree(GetProcessHeap(), 0, This->image_data); - - This->image_data = HeapAlloc(GetProcessHeap(), 0, width * height); - if (This->image_data) - { - This->width = width; - This->height = height; - hr = S_OK; - } - else - hr = E_OUTOFMEMORY; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->encoder->lock); - - return hr; -} - -static HRESULT WINAPI GifFrameEncode_SetResolution(IWICBitmapFrameEncode *iface, double xres, double yres) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p,%f,%f\n", iface, xres, yres); - - EnterCriticalSection(&This->encoder->lock); - - if (This->initialized) - { - This->xres = xres; - This->yres = yres; - hr = S_OK; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->encoder->lock); - - return hr; -} - -static HRESULT WINAPI GifFrameEncode_SetPixelFormat(IWICBitmapFrameEncode *iface, WICPixelFormatGUID *format) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p,%s\n", iface, debugstr_guid(format)); - - if (!format) return E_INVALIDARG; - - EnterCriticalSection(&This->encoder->lock); - - if (This->initialized) - { - *format = GUID_WICPixelFormat8bppIndexed; - hr = S_OK; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->encoder->lock); - - return hr; -} - -static HRESULT WINAPI GifFrameEncode_SetColorContexts(IWICBitmapFrameEncode *iface, UINT count, IWICColorContext **context) -{ - FIXME("%p,%u,%p: stub\n", iface, count, context); - return E_NOTIMPL; -} - -static HRESULT WINAPI GifFrameEncode_SetPalette(IWICBitmapFrameEncode *iface, IWICPalette *palette) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p,%p\n", iface, palette); - - if (!palette) return E_INVALIDARG; - - EnterCriticalSection(&This->encoder->lock); - - if (This->initialized) - hr = IWICPalette_GetColors(palette, 256, This->palette, &This->colors); - else - hr = WINCODEC_ERR_NOTINITIALIZED; - - LeaveCriticalSection(&This->encoder->lock); - return hr; -} - -static HRESULT WINAPI GifFrameEncode_SetThumbnail(IWICBitmapFrameEncode *iface, IWICBitmapSource *thumbnail) -{ - FIXME("%p,%p: stub\n", iface, thumbnail); - return E_NOTIMPL; -} - -static HRESULT WINAPI GifFrameEncode_WritePixels(IWICBitmapFrameEncode *iface, UINT lines, UINT stride, UINT size, BYTE *pixels) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p,%u,%u,%u,%p\n", iface, lines, stride, size, pixels); - - if (!pixels) return E_INVALIDARG; - - EnterCriticalSection(&This->encoder->lock); - - if (This->initialized && This->image_data) - { - if (This->lines + lines <= This->height) - { - UINT i; - BYTE *src, *dst; - - src = pixels; - dst = This->image_data + This->lines * This->width; - - for (i = 0; i < lines; i++) - { - memcpy(dst, src, This->width); - src += stride; - dst += This->width; - } - - This->lines += lines; - hr = S_OK; - } - else - hr = E_INVALIDARG; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->encoder->lock); - return hr; -} - -static HRESULT WINAPI GifFrameEncode_WriteSource(IWICBitmapFrameEncode *iface, IWICBitmapSource *source, WICRect *rc) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p,%p,%p\n", iface, source, rc); - - if (!source) return E_INVALIDARG; - - EnterCriticalSection(&This->encoder->lock); - - if (This->initialized) - { - const GUID *format = &GUID_WICPixelFormat8bppIndexed; - - hr = configure_write_source(iface, source, rc, format, - This->width, This->height, This->xres, This->yres); - if (hr == S_OK) - hr = write_source(iface, source, rc, format, 8, This->width, This->height); - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->encoder->lock); - return hr; -} - -#define LZW_DICT_SIZE (1 << 12) - -struct lzw_dict -{ - short prefix[LZW_DICT_SIZE]; - unsigned char suffix[LZW_DICT_SIZE]; -}; - -struct lzw_state -{ - struct lzw_dict dict; - short init_code_bits, code_bits, next_code, clear_code, eof_code; - unsigned bits_buf; - int bits_count; - int (*user_write_data)(void *user_ptr, void *data, int length); - void *user_ptr; -}; - -struct input_stream -{ - unsigned len; - const BYTE *in; -}; - -struct output_stream -{ - struct - { - unsigned char len; - char data[255]; - } gif_block; - IStream *out; -}; - -static int lzw_output_code(struct lzw_state *state, short code) -{ - state->bits_buf |= code << state->bits_count; - state->bits_count += state->code_bits; - - while (state->bits_count >= 8) - { - unsigned char byte = (unsigned char)state->bits_buf; - if (state->user_write_data(state->user_ptr, &byte, 1) != 1) - return 0; - state->bits_buf >>= 8; - state->bits_count -= 8; - } - - return 1; -} - -static inline int lzw_output_clear_code(struct lzw_state *state) -{ - return lzw_output_code(state, state->clear_code); -} - -static inline int lzw_output_eof_code(struct lzw_state *state) -{ - return lzw_output_code(state, state->eof_code); -} - -static int lzw_flush_bits(struct lzw_state *state) -{ - unsigned char byte; - - while (state->bits_count >= 8) - { - byte = (unsigned char)state->bits_buf; - if (state->user_write_data(state->user_ptr, &byte, 1) != 1) - return 0; - state->bits_buf >>= 8; - state->bits_count -= 8; - } - - if (state->bits_count) - { - static const char mask[8] = { 0x00,0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f }; - - byte = (unsigned char)state->bits_buf & mask[state->bits_count]; - if (state->user_write_data(state->user_ptr, &byte, 1) != 1) - return 0; - } - - state->bits_buf = 0; - state->bits_count = 0; - - return 1; -} - -static void lzw_dict_reset(struct lzw_state *state) -{ - int i; - - state->code_bits = state->init_code_bits + 1; - state->next_code = (1 << state->init_code_bits) + 2; - - for(i = 0; i < LZW_DICT_SIZE; i++) - { - state->dict.prefix[i] = 1 << 12; /* impossible LZW code value */ - state->dict.suffix[i] = 0; - } -} - -static void lzw_state_init(struct lzw_state *state, short init_code_bits, void *user_write_data, void *user_ptr) -{ - state->init_code_bits = init_code_bits; - state->clear_code = 1 << init_code_bits; - state->eof_code = state->clear_code + 1; - state->bits_buf = 0; - state->bits_count = 0; - state->user_write_data = user_write_data; - state->user_ptr = user_ptr; - - lzw_dict_reset(state); -} - -static int lzw_dict_add(struct lzw_state *state, short prefix, unsigned char suffix) -{ - if (state->next_code < LZW_DICT_SIZE) - { - state->dict.prefix[state->next_code] = prefix; - state->dict.suffix[state->next_code] = suffix; - - if ((state->next_code & (state->next_code - 1)) == 0) - state->code_bits++; - - state->next_code++; - return state->next_code; - } - - return -1; -} - -static short lzw_dict_lookup(const struct lzw_state *state, short prefix, unsigned char suffix) -{ - short i; - - for (i = 0; i < state->next_code; i++) - { - if (state->dict.prefix[i] == prefix && state->dict.suffix[i] == suffix) - return i; - } - - return -1; -} - -static inline int write_byte(struct output_stream *out, char byte) -{ - if (out->gif_block.len == 255) - { - if (IStream_Write(out->out, &out->gif_block, sizeof(out->gif_block), NULL) != S_OK) - return 0; - - out->gif_block.len = 0; - } - - out->gif_block.data[out->gif_block.len++] = byte; - - return 1; -} - -static int write_data(void *user_ptr, void *user_data, int length) -{ - unsigned char *data = user_data; - struct output_stream *out = user_ptr; - int len = length; - - while (len-- > 0) - { - if (!write_byte(out, *data++)) return 0; - } - - return length; -} - -static int flush_output_data(void *user_ptr) -{ - struct output_stream *out = user_ptr; - - if (out->gif_block.len) - { - if (IStream_Write(out->out, &out->gif_block, out->gif_block.len + sizeof(out->gif_block.len), NULL) != S_OK) - return 0; - } - - /* write GIF block terminator */ - out->gif_block.len = 0; - return IStream_Write(out->out, &out->gif_block, sizeof(out->gif_block.len), NULL) == S_OK; -} - -static inline int read_byte(struct input_stream *in, unsigned char *byte) -{ - if (in->len) - { - in->len--; - *byte = *in->in++; - return 1; - } - - return 0; -} - -static HRESULT gif_compress(IStream *out_stream, const BYTE *in_data, ULONG in_size) -{ - struct input_stream in; - struct output_stream out; - struct lzw_state state; - short init_code_bits, prefix, code; - unsigned char suffix; - - in.in = in_data; - in.len = in_size; - - out.gif_block.len = 0; - out.out = out_stream; - - init_code_bits = suffix = 8; - if (IStream_Write(out.out, &suffix, sizeof(suffix), NULL) != S_OK) - return E_FAIL; - - lzw_state_init(&state, init_code_bits, write_data, &out); - - if (!lzw_output_clear_code(&state)) - return E_FAIL; - - if (read_byte(&in, &suffix)) - { - prefix = suffix; - - while (read_byte(&in, &suffix)) - { - code = lzw_dict_lookup(&state, prefix, suffix); - if (code == -1) - { - if (!lzw_output_code(&state, prefix)) - return E_FAIL; - - if (lzw_dict_add(&state, prefix, suffix) == -1) - { - if (!lzw_output_clear_code(&state)) - return E_FAIL; - lzw_dict_reset(&state); - } - - prefix = suffix; - } - else - prefix = code; - } - - if (!lzw_output_code(&state, prefix)) - return E_FAIL; - if (!lzw_output_eof_code(&state)) - return E_FAIL; - if (!lzw_flush_bits(&state)) - return E_FAIL; - } - - return flush_output_data(&out) ? S_OK : E_FAIL; -} - -static HRESULT WINAPI GifFrameEncode_Commit(IWICBitmapFrameEncode *iface) -{ - GifFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface); - HRESULT hr; - - TRACE("%p\n", iface); - - EnterCriticalSection(&This->encoder->lock); - - if (This->image_data && This->lines == This->height && !This->committed) - { - BYTE gif_palette[256][3]; - - hr = S_OK; - - if (!This->encoder->info_written) - { - struct logical_screen_descriptor lsd; - - /* Logical Screen Descriptor */ - memcpy(lsd.signature, "GIF89a", 6); - lsd.width = This->width; - lsd.height = This->height; - lsd.packed = 0; - if (This->encoder->colors) - lsd.packed |= 0x80; /* global color table flag */ - lsd.packed |= 0x07 << 4; /* color resolution */ - lsd.packed |= 0x07; /* global color table size */ - lsd.background_color_index = 0; /* FIXME */ - lsd.pixel_aspect_ratio = 0; - hr = IStream_Write(This->encoder->stream, &lsd, sizeof(lsd), NULL); - if (hr == S_OK && This->encoder->colors) - { - UINT i; - - /* Global Color Table */ - memset(gif_palette, 0, sizeof(gif_palette)); - for (i = 0; i < This->encoder->colors; i++) - { - gif_palette[i][0] = (This->encoder->palette[i] >> 16) & 0xff; - gif_palette[i][1] = (This->encoder->palette[i] >> 8) & 0xff; - gif_palette[i][2] = This->encoder->palette[i] & 0xff; - } - hr = IStream_Write(This->encoder->stream, gif_palette, sizeof(gif_palette), NULL); - } - - /* FIXME: write GCE, APE, etc. GIF extensions */ - - if (hr == S_OK) - This->encoder->info_written = TRUE; - } - - if (hr == S_OK) - { - char image_separator = 0x2c; - - hr = IStream_Write(This->encoder->stream, &image_separator, sizeof(image_separator), NULL); - if (hr == S_OK) - { - struct image_descriptor imd; - - /* Image Descriptor */ - imd.left = 0; - imd.top = 0; - imd.width = This->width; - imd.height = This->height; - imd.packed = 0; - if (This->colors) - { - imd.packed |= 0x80; /* local color table flag */ - imd.packed |= 0x07; /* local color table size */ - } - /* FIXME: interlace flag */ - hr = IStream_Write(This->encoder->stream, &imd, sizeof(imd), NULL); - if (hr == S_OK && This->colors) - { - UINT i; - - /* Local Color Table */ - memset(gif_palette, 0, sizeof(gif_palette)); - for (i = 0; i < This->colors; i++) - { - gif_palette[i][0] = (This->palette[i] >> 16) & 0xff; - gif_palette[i][1] = (This->palette[i] >> 8) & 0xff; - gif_palette[i][2] = This->palette[i] & 0xff; - } - hr = IStream_Write(This->encoder->stream, gif_palette, sizeof(gif_palette), NULL); - if (hr == S_OK) - { - /* Image Data */ - hr = gif_compress(This->encoder->stream, This->image_data, This->width * This->height); - if (hr == S_OK) - This->committed = TRUE; - } - } - } - } - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->encoder->lock); - return hr; -} - -static HRESULT WINAPI GifFrameEncode_GetMetadataQueryWriter(IWICBitmapFrameEncode *iface, IWICMetadataQueryWriter **writer) -{ - FIXME("%p, %p: stub\n", iface, writer); - return E_NOTIMPL; -} - -static const IWICBitmapFrameEncodeVtbl GifFrameEncode_Vtbl = -{ - GifFrameEncode_QueryInterface, - GifFrameEncode_AddRef, - GifFrameEncode_Release, - GifFrameEncode_Initialize, - GifFrameEncode_SetSize, - GifFrameEncode_SetResolution, - GifFrameEncode_SetPixelFormat, - GifFrameEncode_SetColorContexts, - GifFrameEncode_SetPalette, - GifFrameEncode_SetThumbnail, - GifFrameEncode_WritePixels, - GifFrameEncode_WriteSource, - GifFrameEncode_Commit, - GifFrameEncode_GetMetadataQueryWriter -}; - -static HRESULT WINAPI GifEncoder_QueryInterface(IWICBitmapEncoder *iface, REFIID iid, void **ppv) -{ - TRACE("%p,%s,%p\n", iface, debugstr_guid(iid), ppv); - - if (!ppv) return E_INVALIDARG; - - if (IsEqualIID(&IID_IUnknown, iid) || - IsEqualIID(&IID_IWICBitmapEncoder, iid)) - { - IWICBitmapEncoder_AddRef(iface); - *ppv = iface; - return S_OK; - } - - *ppv = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI GifEncoder_AddRef(IWICBitmapEncoder *iface) -{ - GifEncoder *This = impl_from_IWICBitmapEncoder(iface); - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("%p -> %u\n", iface, ref); - return ref; -} - -static ULONG WINAPI GifEncoder_Release(IWICBitmapEncoder *iface) -{ - GifEncoder *This = impl_from_IWICBitmapEncoder(iface); - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("%p -> %u\n", iface, ref); - - if (!ref) - { - if (This->stream) IStream_Release(This->stream); - This->lock.DebugInfo->Spare[0] = 0; - DeleteCriticalSection(&This->lock); - HeapFree(GetProcessHeap(), 0, This); - } - - return ref; -} - -static HRESULT WINAPI GifEncoder_Initialize(IWICBitmapEncoder *iface, IStream *stream, WICBitmapEncoderCacheOption option) -{ - GifEncoder *This = impl_from_IWICBitmapEncoder(iface); - HRESULT hr; - - TRACE("%p,%p,%#x\n", iface, stream, option); - - if (!stream) return E_INVALIDARG; - - EnterCriticalSection(&This->lock); - - if (!This->initialized) - { - IStream_AddRef(stream); - This->stream = stream; - This->initialized = TRUE; - hr = S_OK; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->lock); - - return hr; -} - -static HRESULT WINAPI GifEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format) -{ - if (!format) return E_INVALIDARG; - - *format = GUID_ContainerFormatGif; - return S_OK; -} - -static HRESULT WINAPI GifEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info) -{ - IWICComponentInfo *comp_info; - HRESULT hr; - - TRACE("%p,%p\n", iface, info); - - if (!info) return E_INVALIDARG; - - hr = CreateComponentInfo(&CLSID_WICGifEncoder, &comp_info); - if (hr == S_OK) - { - hr = IWICComponentInfo_QueryInterface(comp_info, &IID_IWICBitmapEncoderInfo, (void **)info); - IWICComponentInfo_Release(comp_info); - } - return hr; -} - -static HRESULT WINAPI GifEncoder_SetColorContexts(IWICBitmapEncoder *iface, UINT count, IWICColorContext **context) -{ - FIXME("%p,%u,%p: stub\n", iface, count, context); - return E_NOTIMPL; -} - -static HRESULT WINAPI GifEncoder_SetPalette(IWICBitmapEncoder *iface, IWICPalette *palette) -{ - GifEncoder *This = impl_from_IWICBitmapEncoder(iface); - HRESULT hr; - - TRACE("%p,%p\n", iface, palette); - - if (!palette) return E_INVALIDARG; - - EnterCriticalSection(&This->lock); - - if (This->initialized) - hr = IWICPalette_GetColors(palette, 256, This->palette, &This->colors); - else - hr = WINCODEC_ERR_NOTINITIALIZED; - - LeaveCriticalSection(&This->lock); - return hr; -} - -static HRESULT WINAPI GifEncoder_SetThumbnail(IWICBitmapEncoder *iface, IWICBitmapSource *thumbnail) -{ - TRACE("%p,%p\n", iface, thumbnail); - return WINCODEC_ERR_UNSUPPORTEDOPERATION; -} - -static HRESULT WINAPI GifEncoder_SetPreview(IWICBitmapEncoder *iface, IWICBitmapSource *preview) -{ - TRACE("%p,%p\n", iface, preview); - return WINCODEC_ERR_UNSUPPORTEDOPERATION; -} - -static HRESULT WINAPI GifEncoder_CreateNewFrame(IWICBitmapEncoder *iface, IWICBitmapFrameEncode **frame, IPropertyBag2 **options) -{ - GifEncoder *This = impl_from_IWICBitmapEncoder(iface); - HRESULT hr; - - TRACE("%p,%p,%p\n", iface, frame, options); - - if (!frame) return E_INVALIDARG; - - EnterCriticalSection(&This->lock); - - if (This->initialized && !This->committed) - { - GifFrameEncode *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret)); - if (ret) - { - This->n_frames++; - - ret->IWICBitmapFrameEncode_iface.lpVtbl = &GifFrameEncode_Vtbl; - ret->ref = 1; - ret->encoder = This; - ret->initialized = FALSE; - ret->interlace = FALSE; /* FIXME: read from the properties */ - ret->committed = FALSE; - ret->width = 0; - ret->height = 0; - ret->lines = 0; - ret->xres = 0.0; - ret->yres = 0.0; - ret->colors = 0; - ret->image_data = NULL; - IWICBitmapEncoder_AddRef(iface); - *frame = &ret->IWICBitmapFrameEncode_iface; - - hr = S_OK; - - if (options) - { - hr = CreatePropertyBag2(NULL, 0, options); - if (hr != S_OK) - { - IWICBitmapFrameEncode_Release(*frame); - *frame = NULL; - } - } - } - else - hr = E_OUTOFMEMORY; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->lock); - - return hr; - -} - -static HRESULT WINAPI GifEncoder_Commit(IWICBitmapEncoder *iface) -{ - GifEncoder *This = impl_from_IWICBitmapEncoder(iface); - HRESULT hr; - - TRACE("%p\n", iface); - - EnterCriticalSection(&This->lock); - - if (This->initialized && !This->committed) - { - char gif_trailer = 0x3b; - - /* FIXME: write text, comment GIF extensions */ - - hr = IStream_Write(This->stream, &gif_trailer, sizeof(gif_trailer), NULL); - if (hr == S_OK) - This->committed = TRUE; - } - else - hr = WINCODEC_ERR_WRONGSTATE; - - LeaveCriticalSection(&This->lock); - return hr; -} - -static HRESULT WINAPI GifEncoder_GetMetadataQueryWriter(IWICBitmapEncoder *iface, IWICMetadataQueryWriter **writer) -{ - FIXME("%p,%p: stub\n", iface, writer); - return E_NOTIMPL; -} - -static const IWICBitmapEncoderVtbl GifEncoder_Vtbl = -{ - GifEncoder_QueryInterface, - GifEncoder_AddRef, - GifEncoder_Release, - GifEncoder_Initialize, - GifEncoder_GetContainerFormat, - GifEncoder_GetEncoderInfo, - GifEncoder_SetColorContexts, - GifEncoder_SetPalette, - GifEncoder_SetThumbnail, - GifEncoder_SetPreview, - GifEncoder_CreateNewFrame, - GifEncoder_Commit, - GifEncoder_GetMetadataQueryWriter -}; - -HRESULT GifEncoder_CreateInstance(REFIID iid, void **ppv) -{ - GifEncoder *This; - HRESULT ret; - - TRACE("%s,%p\n", debugstr_guid(iid), ppv); - - *ppv = NULL; - - This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); - if (!This) return E_OUTOFMEMORY; - - This->IWICBitmapEncoder_iface.lpVtbl = &GifEncoder_Vtbl; - This->ref = 1; - This->stream = NULL; - InitializeCriticalSection(&This->lock); - This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": GifEncoder.lock"); - This->initialized = FALSE; - This->info_written = FALSE; - This->committed = FALSE; - This->n_frames = 0; - This->colors = 0; - - ret = IWICBitmapEncoder_QueryInterface(&This->IWICBitmapEncoder_iface, iid, ppv); - IWICBitmapEncoder_Release(&This->IWICBitmapEncoder_iface); - - return ret; -} diff --git a/dll/win32/windowscodecs/imgfactory.c b/dll/win32/windowscodecs/imgfactory.c index cfb7fc1bf1..623265762a 100644 --- a/dll/win32/windowscodecs/imgfactory.c +++ b/dll/win32/windowscodecs/imgfactory.c @@ -104,23 +104,22 @@ static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename( return hr; }
-static HRESULT find_decoder(IStream *pIStream, const GUID *pguidVendor, - WICDecodeOptions metadataOptions, IWICBitmapDecoder **decoder) +static IWICBitmapDecoder *find_decoder(IStream *pIStream, const GUID *pguidVendor, + WICDecodeOptions metadataOptions) { IEnumUnknown *enumdecoders; IUnknown *unkdecoderinfo; IWICBitmapDecoderInfo *decoderinfo; + IWICBitmapDecoder *decoder = NULL; GUID vendor; HRESULT res; ULONG num_fetched; BOOL matches;
- *decoder = NULL; - res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders); - if (FAILED(res)) return res; + if (FAILED(res)) return NULL;
- while (!*decoder) + while (!decoder) { res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
@@ -145,21 +144,18 @@ static HRESULT find_decoder(IStream *pIStream, const GUID *pguidVendor,
if (SUCCEEDED(res) && matches) { - res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, decoder); + res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &decoder);
/* FIXME: should use QueryCapability to choose a decoder */
if (SUCCEEDED(res)) { - res = IWICBitmapDecoder_Initialize(*decoder, pIStream, metadataOptions); + res = IWICBitmapDecoder_Initialize(decoder, pIStream, metadataOptions);
if (FAILED(res)) { - IWICBitmapDecoder_Release(*decoder); - IWICBitmapDecoderInfo_Release(decoderinfo); - IUnknown_Release(unkdecoderinfo); - *decoder = NULL; - return res; + IWICBitmapDecoder_Release(decoder); + decoder = NULL; } } } @@ -175,7 +171,7 @@ static HRESULT find_decoder(IStream *pIStream, const GUID *pguidVendor,
IEnumUnknown_Release(enumdecoders);
- return WINCODEC_ERR_COMPONENTNOTFOUND; + return decoder; }
static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream( @@ -189,9 +185,9 @@ static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream( metadataOptions, ppIDecoder);
if (pguidVendor) - res = find_decoder(pIStream, pguidVendor, metadataOptions, &decoder); + decoder = find_decoder(pIStream, pguidVendor, metadataOptions); if (!decoder) - res = find_decoder(pIStream, NULL, metadataOptions, &decoder); + decoder = find_decoder(pIStream, NULL, metadataOptions);
if (decoder) { @@ -206,17 +202,17 @@ static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream( BYTE data[4]; ULONG bytesread;
- WARN("failed to load from a stream %#x\n", res); + WARN("failed to load from a stream\n");
seek.QuadPart = 0; - if (IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL) == S_OK) - { - if (IStream_Read(pIStream, data, 4, &bytesread) == S_OK) - WARN("first %i bytes of stream=%x %x %x %x\n", bytesread, data[0], data[1], data[2], data[3]); - } + res = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL); + if (SUCCEEDED(res)) + res = IStream_Read(pIStream, data, 4, &bytesread); + if (SUCCEEDED(res)) + WARN("first %i bytes of stream=%x %x %x %x\n", bytesread, data[0], data[1], data[2], data[3]); } *ppIDecoder = NULL; - return res; + return WINCODEC_ERR_COMPONENTNOTFOUND; } }
@@ -583,36 +579,12 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFacto UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, IWICBitmap **bitmap) { - HRESULT hr; - TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height, debugstr_guid(format), stride, size, buffer, bitmap);
if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG;
- hr = BitmapImpl_Create(width, height, stride, size, NULL, format, WICBitmapCacheOnLoad, bitmap); - if (SUCCEEDED(hr)) - { - IWICBitmapLock *lock; - - hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock); - if (SUCCEEDED(hr)) - { - UINT buffersize; - BYTE *data; - - IWICBitmapLock_GetDataPointer(lock, &buffersize, &data); - memcpy(data, buffer, buffersize); - - IWICBitmapLock_Release(lock); - } - else - { - IWICBitmap_Release(*bitmap); - *bitmap = NULL; - } - } - return hr; + return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap); }
static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format) @@ -1188,50 +1160,3 @@ HRESULT ComponentFactory_CreateInstance(REFIID iid, void** ppv)
return ret; } - -HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, - REFWICPixelFormatGUID format, HANDLE section, UINT stride, - UINT offset, WICSectionAccessLevel wicaccess, IWICBitmap **bitmap) -{ - DWORD access; - void *buffer; - HRESULT hr; - - TRACE("%u,%u,%s,%p,%u,%#x,%#x,%p\n", width, height, debugstr_guid(format), - section, stride, offset, wicaccess, bitmap); - - if (!width || !height || !section || !bitmap) return E_INVALIDARG; - - switch (wicaccess) - { - case WICSectionAccessLevelReadWrite: - access = FILE_MAP_READ | FILE_MAP_WRITE; - break; - - case WICSectionAccessLevelRead: - access = FILE_MAP_READ; - break; - - default: - FIXME("unsupported access %#x\n", wicaccess); - return E_INVALIDARG; - } - - buffer = MapViewOfFile(section, access, 0, offset, 0); - if (!buffer) return HRESULT_FROM_WIN32(GetLastError()); - - hr = BitmapImpl_Create(width, height, stride, 0, buffer, format, WICBitmapCacheOnLoad, bitmap); - if (FAILED(hr)) UnmapViewOfFile(buffer); - return hr; -} - -HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, - REFWICPixelFormatGUID format, HANDLE section, - UINT stride, UINT offset, IWICBitmap **bitmap) -{ - TRACE("%u,%u,%s,%p,%u,%u,%p\n", width, height, debugstr_guid(format), - section, stride, offset, bitmap); - - return WICCreateBitmapFromSectionEx(width, height, format, section, - stride, offset, WICSectionAccessLevelRead, bitmap); -} diff --git a/dll/win32/windowscodecs/info.c b/dll/win32/windowscodecs/info.c index d3ea8754a2..63cdc07dbc 100644 --- a/dll/win32/windowscodecs/info.c +++ b/dll/win32/windowscodecs/info.c @@ -853,12 +853,8 @@ static HRESULT WINAPI BitmapEncoderInfo_GetMimeTypes(IWICBitmapEncoderInfo *ifac static HRESULT WINAPI BitmapEncoderInfo_GetFileExtensions(IWICBitmapEncoderInfo *iface, UINT cchFileExtensions, WCHAR *wzFileExtensions, UINT *pcchActual) { - BitmapEncoderInfo *This = impl_from_IWICBitmapEncoderInfo(iface); - - TRACE("(%p,%u,%p,%p)\n", iface, cchFileExtensions, wzFileExtensions, pcchActual); - - return ComponentInfo_GetStringValue(This->classkey, fileextensions_valuename, - cchFileExtensions, wzFileExtensions, pcchActual); + FIXME("(%p,%u,%p,%p): stub\n", iface, cchFileExtensions, wzFileExtensions, pcchActual); + return E_NOTIMPL; }
static HRESULT WINAPI BitmapEncoderInfo_DoesSupportAnimation(IWICBitmapEncoderInfo *iface, @@ -2269,12 +2265,6 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn return hr; }
-static BOOL is_1bpp_format(const WICPixelFormatGUID *format) -{ - return IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite) || - IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed); -} - HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst) { HRESULT res; @@ -2287,12 +2277,10 @@ HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitma BOOL canconvert; ULONG num_fetched;
- TRACE("%s,%p,%p\n", debugstr_guid(dstFormat), pISrc, ppIDst); - res = IWICBitmapSource_GetPixelFormat(pISrc, &srcFormat); if (FAILED(res)) return res;
- if (IsEqualGUID(&srcFormat, dstFormat) || (is_1bpp_format(&srcFormat) && is_1bpp_format(dstFormat))) + if (IsEqualGUID(&srcFormat, dstFormat)) { IWICBitmapSource_AddRef(pISrc); *ppIDst = pISrc; @@ -2329,7 +2317,7 @@ HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitma
if (SUCCEEDED(res) && canconvert) res = IWICFormatConverter_Initialize(converter, pISrc, dstFormat, WICBitmapDitherTypeNone, - NULL, 0.0, WICBitmapPaletteTypeMedianCut); + NULL, 0.0, WICBitmapPaletteTypeCustom);
if (FAILED(res) || !canconvert) { diff --git a/dll/win32/windowscodecs/jpegformat.c b/dll/win32/windowscodecs/jpegformat.c index ecbfc01c3c..cfb84c36aa 100644 --- a/dll/win32/windowscodecs/jpegformat.c +++ b/dll/win32/windowscodecs/jpegformat.c @@ -137,7 +137,6 @@ typedef struct { struct jpeg_error_mgr jerr; struct jpeg_source_mgr source_mgr; BYTE source_buffer[1024]; - UINT bpp, stride; BYTE *image_data; CRITICAL_SECTION lock; } JpegDecoder; @@ -286,8 +285,6 @@ static HRESULT WINAPI JpegDecoder_Initialize(IWICBitmapDecoder *iface, IStream * int ret; LARGE_INTEGER seek; jmp_buf jmpbuf; - UINT data_size, i; - TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOptions);
EnterCriticalSection(&This->lock); @@ -366,55 +363,6 @@ static HRESULT WINAPI JpegDecoder_Initialize(IWICBitmapDecoder *iface, IStream * return E_FAIL; }
- if (This->cinfo.out_color_space == JCS_GRAYSCALE) This->bpp = 8; - else if (This->cinfo.out_color_space == JCS_CMYK) This->bpp = 32; - else This->bpp = 24; - - This->stride = (This->bpp * This->cinfo.output_width + 7) / 8; - data_size = This->stride * This->cinfo.output_height; - - This->image_data = HeapAlloc(GetProcessHeap(), 0, data_size); - if (!This->image_data) - { - LeaveCriticalSection(&This->lock); - return E_OUTOFMEMORY; - } - - while (This->cinfo.output_scanline < This->cinfo.output_height) - { - UINT first_scanline = This->cinfo.output_scanline; - UINT max_rows; - JSAMPROW out_rows[4]; - JDIMENSION ret; - - max_rows = min(This->cinfo.output_height-first_scanline, 4); - for (i=0; i<max_rows; i++) - out_rows[i] = This->image_data + This->stride * (first_scanline+i); - - ret = pjpeg_read_scanlines(&This->cinfo, out_rows, max_rows); - if (ret == 0) - { - ERR("read_scanlines failed\n"); - LeaveCriticalSection(&This->lock); - return E_FAIL; - } - } - - if (This->bpp == 24) - { - /* libjpeg gives us RGB data and we want BGR, so byteswap the data */ - reverse_bgr8(3, This->image_data, - This->cinfo.output_width, This->cinfo.output_height, - This->stride); - } - - if (This->cinfo.out_color_space == JCS_CMYK && This->cinfo.saw_Adobe_marker) - { - /* Adobe JPEG's have inverted CMYK data. */ - for (i=0; i<data_size; i++) - This->image_data[i] ^= 0xff; - } - This->initialized = TRUE;
LeaveCriticalSection(&This->lock); @@ -457,14 +405,10 @@ static HRESULT WINAPI JpegDecoder_CopyPalette(IWICBitmapDecoder *iface, }
static HRESULT WINAPI JpegDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, - IWICMetadataQueryReader **reader) + IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, reader); - - if (!reader) return E_INVALIDARG; - - *reader = NULL; - return WINCODEC_ERR_UNSUPPORTEDOPERATION; + FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); + return E_NOTIMPL; }
static HRESULT WINAPI JpegDecoder_GetPreview(IWICBitmapDecoder *iface, @@ -635,11 +579,98 @@ static HRESULT WINAPI JpegDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) { JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface); - + UINT bpp; + UINT stride; + UINT data_size; + UINT max_row_needed; + jmp_buf jmpbuf; + WICRect rect; TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer);
- return copy_pixels(This->bpp, This->image_data, - This->cinfo.output_width, This->cinfo.output_height, This->stride, + if (!prc) + { + rect.X = 0; + rect.Y = 0; + rect.Width = This->cinfo.output_width; + rect.Height = This->cinfo.output_height; + prc = ▭ + } + else + { + if (prc->X < 0 || prc->Y < 0 || prc->X+prc->Width > This->cinfo.output_width || + prc->Y+prc->Height > This->cinfo.output_height) + return E_INVALIDARG; + } + + if (This->cinfo.out_color_space == JCS_GRAYSCALE) bpp = 8; + else if (This->cinfo.out_color_space == JCS_CMYK) bpp = 32; + else bpp = 24; + + stride = bpp * This->cinfo.output_width; + data_size = stride * This->cinfo.output_height; + + max_row_needed = prc->Y + prc->Height; + if (max_row_needed > This->cinfo.output_height) return E_INVALIDARG; + + EnterCriticalSection(&This->lock); + + if (!This->image_data) + { + This->image_data = HeapAlloc(GetProcessHeap(), 0, data_size); + if (!This->image_data) + { + LeaveCriticalSection(&This->lock); + return E_OUTOFMEMORY; + } + } + + This->cinfo.client_data = jmpbuf; + + if (setjmp(jmpbuf)) + { + LeaveCriticalSection(&This->lock); + return E_FAIL; + } + + while (max_row_needed > This->cinfo.output_scanline) + { + UINT first_scanline = This->cinfo.output_scanline; + UINT max_rows; + JSAMPROW out_rows[4]; + UINT i; + JDIMENSION ret; + + max_rows = min(This->cinfo.output_height-first_scanline, 4); + for (i=0; i<max_rows; i++) + out_rows[i] = This->image_data + stride * (first_scanline+i); + + ret = pjpeg_read_scanlines(&This->cinfo, out_rows, max_rows); + + if (ret == 0) + { + ERR("read_scanlines failed\n"); + LeaveCriticalSection(&This->lock); + return E_FAIL; + } + + if (bpp == 24) + { + /* libjpeg gives us RGB data and we want BGR, so byteswap the data */ + reverse_bgr8(3, This->image_data + stride * first_scanline, + This->cinfo.output_width, This->cinfo.output_scanline - first_scanline, + stride); + } + + if (This->cinfo.out_color_space == JCS_CMYK && This->cinfo.saw_Adobe_marker) + /* Adobe JPEG's have inverted CMYK data. */ + for (i=0; i<data_size; i++) + This->image_data[i] ^= 0xff; + } + + LeaveCriticalSection(&This->lock); + + return copy_pixels(bpp, This->image_data, + This->cinfo.output_width, This->cinfo.output_height, stride, prc, cbStride, cbBufferSize, pbBuffer); }
@@ -1344,22 +1375,11 @@ static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, return E_NOTIMPL; }
-static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info) +static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, + IWICBitmapEncoderInfo **ppIEncoderInfo) { - IWICComponentInfo *comp_info; - HRESULT hr; - - TRACE("%p,%p\n", iface, info); - - if (!info) return E_INVALIDARG; - - hr = CreateComponentInfo(&CLSID_WICJpegEncoder, &comp_info); - if (hr == S_OK) - { - hr = IWICComponentInfo_QueryInterface(comp_info, &IID_IWICBitmapEncoderInfo, (void **)info); - IWICComponentInfo_Release(comp_info); - } - return hr; + FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo); + return E_NOTIMPL; }
static HRESULT WINAPI JpegEncoder_SetColorContexts(IWICBitmapEncoder *iface, @@ -1439,14 +1459,11 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface, opts[5].vt = VT_BOOL; opts[5].dwType = PROPBAG2_TYPE_DATA;
- if (ppIEncoderOptions) + hr = CreatePropertyBag2(opts, 6, ppIEncoderOptions); + if (FAILED(hr)) { - hr = CreatePropertyBag2(opts, 6, ppIEncoderOptions); - if (FAILED(hr)) - { - LeaveCriticalSection(&This->lock); - return hr; - } + LeaveCriticalSection(&This->lock); + return hr; }
This->frame_count = 1; diff --git a/dll/win32/windowscodecs/metadatahandler.c b/dll/win32/windowscodecs/metadatahandler.c index 25f4314720..dff5ed3c7f 100644 --- a/dll/win32/windowscodecs/metadatahandler.c +++ b/dll/win32/windowscodecs/metadatahandler.c @@ -704,7 +704,7 @@ static int tag_to_vt(SHORT tag) static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, MetadataItem *item, BOOL native_byte_order) { - ULONG count, value, i; + ULONG count, value, i, bytesread; SHORT type; LARGE_INTEGER pos; HRESULT hr; @@ -746,7 +746,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
item->value.vt |= VT_VECTOR; item->value.u.caub.cElems = count; - item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count); + item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), 0, count); if (!item->value.u.caub.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value; @@ -756,8 +756,9 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems); return hr; } - hr = IStream_Read(input, item->value.u.caub.pElems, count, NULL); - if (FAILED(hr)) + hr = IStream_Read(input, item->value.u.caub.pElems, count, &bytesread); + if (bytesread != count) hr = E_FAIL; + if (hr != S_OK) { HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems); return hr; @@ -790,7 +791,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
item->value.vt |= VT_VECTOR; item->value.u.caui.cElems = count; - item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 2); + item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), 0, count * 2); if (!item->value.u.caui.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value; @@ -800,8 +801,9 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems); return hr; } - hr = IStream_Read(input, item->value.u.caui.pElems, count * 2, NULL); - if (FAILED(hr)) + hr = IStream_Read(input, item->value.u.caui.pElems, count * 2, &bytesread); + if (bytesread != count * 2) hr = E_FAIL; + if (hr != S_OK) { HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems); return hr; @@ -822,7 +824,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
item->value.vt |= VT_VECTOR; item->value.u.caul.cElems = count; - item->value.u.caul.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 4); + item->value.u.caul.pElems = HeapAlloc(GetProcessHeap(), 0, count * 4); if (!item->value.u.caul.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value; @@ -832,8 +834,9 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems); return hr; } - hr = IStream_Read(input, item->value.u.caul.pElems, count * 4, NULL); - if (FAILED(hr)) + hr = IStream_Read(input, item->value.u.caul.pElems, count * 4, &bytesread); + if (bytesread != count * 4) hr = E_FAIL; + if (hr != S_OK) { HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems); return hr; @@ -859,7 +862,8 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, hr = IStream_Seek(input, pos, SEEK_SET, NULL); if (FAILED(hr)) return hr;
- hr = IStream_Read(input, &ull, sizeof(ull), NULL); + hr = IStream_Read(input, &ull, sizeof(ull), &bytesread); + if (bytesread != sizeof(ull)) hr = E_FAIL; if (hr != S_OK) return hr;
item->value.u.uhVal.QuadPart = ull; @@ -877,7 +881,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, { item->value.vt |= VT_VECTOR; item->value.u.cauh.cElems = count; - item->value.u.cauh.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 8); + item->value.u.cauh.pElems = HeapAlloc(GetProcessHeap(), 0, count * 8); if (!item->value.u.cauh.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value; @@ -887,8 +891,9 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems); return hr; } - hr = IStream_Read(input, item->value.u.cauh.pElems, count * 8, NULL); - if (FAILED(hr)) + hr = IStream_Read(input, item->value.u.cauh.pElems, count * 8, &bytesread); + if (bytesread != count * 8) hr = E_FAIL; + if (hr != S_OK) { HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems); return hr; @@ -906,7 +911,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, } break; case IFD_ASCII: - item->value.u.pszVal = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count + 1); + item->value.u.pszVal = HeapAlloc(GetProcessHeap(), 0, count + 1); if (!item->value.u.pszVal) return E_OUTOFMEMORY;
if (count <= 4) @@ -924,8 +929,9 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, HeapFree(GetProcessHeap(), 0, item->value.u.pszVal); return hr; } - hr = IStream_Read(input, item->value.u.pszVal, count, NULL); - if (FAILED(hr)) + hr = IStream_Read(input, item->value.u.pszVal, count, &bytesread); + if (bytesread != count) hr = E_FAIL; + if (hr != S_OK) { HeapFree(GetProcessHeap(), 0, item->value.u.pszVal); return hr; @@ -940,7 +946,7 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, break; }
- item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count); + item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), 0, count); if (!item->value.u.blob.pBlobData) return E_OUTOFMEMORY;
item->value.u.blob.cbSize = count; @@ -959,8 +965,9 @@ static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry, HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData); return hr; } - hr = IStream_Read(input, item->value.u.blob.pBlobData, count, NULL); - if (FAILED(hr)) + hr = IStream_Read(input, item->value.u.blob.pBlobData, count, &bytesread); + if (bytesread != count) hr = E_FAIL; + if (hr != S_OK) { HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData); return hr; diff --git a/dll/win32/windowscodecs/palette.c b/dll/win32/windowscodecs/palette.c index d31cb554d8..89b10b7ba9 100644 --- a/dll/win32/windowscodecs/palette.c +++ b/dll/win32/windowscodecs/palette.c @@ -1,7 +1,6 @@ /* * Copyright 2009 Vincent Povirk for CodeWeavers - * Copyright 2012,2016 Dmitry Timoshkov - * Copyright 2016 Sebastian Lackner + * Copyright 2012 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -432,279 +431,11 @@ static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface, return S_OK; }
-#define R_COUNT (1 << 5) -#define R_SHIFT (8 - 5) -#define R_SCALE 2 - -#define G_COUNT (1 << 6) -#define G_SHIFT (8 - 6) -#define G_SCALE 3 - -#define B_COUNT (1 << 5) -#define B_SHIFT (8 - 5) -#define B_SCALE 1 - -struct histogram -{ - unsigned int data[R_COUNT][G_COUNT][B_COUNT]; -}; - -struct box -{ - int r_min, r_max; - int g_min, g_max; - int b_min, b_max; - unsigned int count; - unsigned int score; -}; - -/* count nonzero elements in the histogram range [r_min, r_max] x [g_min, g_max] x [b_min, b_max] */ -static inline unsigned int histogram_count(struct histogram *h, int r_min, int r_max, - int g_min, int g_max, int b_min, int b_max) -{ - unsigned int count = 0; - int r, g, b; - for (r = r_min; r <= r_max; r++) - for (g = g_min; g <= g_max; g++) - for (b = b_min; b <= b_max; b++) - if (h->data[r][g][b] != 0) count++; - return count; -} - -/* compute weighted average color in the range [r_min, r_max] x [g_min, g_max] x [b_min, b_max] */ -static unsigned int histogram_color(struct histogram *h, int r_min, int r_max, - int g_min, int g_max, int b_min, int b_max) -{ - unsigned long long r_sum = 0, g_sum = 0, b_sum = 0; - unsigned int tmp, count = 0; - int r, g, b; - - for (r = r_min; r <= r_max; r++) - for (g = g_min; g <= g_max; g++) - for (b = b_min; b <= b_max; b++) - { - if (!(tmp = h->data[r][g][b])) continue; - r_sum += ((r << R_SHIFT) + ((1 << R_SHIFT) / 2)) * tmp; - g_sum += ((g << G_SHIFT) + ((1 << G_SHIFT) / 2)) * tmp; - b_sum += ((b << B_SHIFT) + ((1 << B_SHIFT) / 2)) * tmp; - count += tmp; - } - - return ((b_sum + (count / 2)) / count) | - ((g_sum + (count / 2)) / count) << 8 | - ((r_sum + (count / 2)) / count) << 16 | 0xff000000; -} - -/* same as histogram_count */ -static inline unsigned int box_count(struct histogram *h, struct box *b) -{ - return histogram_count(h, b->r_min, b->r_max, b->g_min, b->g_max, b->b_min, b->b_max); -} - -/* same as histogram_color */ -static inline unsigned int box_color(struct histogram *h, struct box *b) -{ - return histogram_color(h, b->r_min, b->r_max, b->g_min, b->g_max, b->b_min, b->b_max); -} - -/* compute score used to determine best split (also called "volume") */ -static inline unsigned int box_score(struct box *b) -{ - unsigned int tmp, sum = 0; - tmp = ((b->r_max - b->r_min) << R_SHIFT) * R_SCALE; sum += tmp * tmp; - tmp = ((b->g_max - b->g_min) << G_SHIFT) * G_SCALE; sum += tmp * tmp; - tmp = ((b->b_max - b->b_min) << B_SHIFT) * B_SCALE; sum += tmp * tmp; - return sum; -} - -/* attempt to shrink a box */ -static void shrink_box(struct histogram *h, struct box *b) -{ - int i; - for (i = b->r_min; i <= b->r_max; i++) - if (histogram_count(h, i, i, b->g_min, b->g_max, b->b_min, b->b_max)) { b->r_min = i; break; } - for (i = b->r_max; i >= b->r_min; i--) - if (histogram_count(h, i, i, b->g_min, b->g_max, b->b_min, b->b_max)) { b->r_max = i; break; } - for (i = b->g_min; i <= b->g_max; i++) - if (histogram_count(h, b->r_min, b->r_max, i, i, b->b_min, b->b_max)) { b->g_min = i; break; } - for (i = b->g_max; i >= b->g_min; i--) - if (histogram_count(h, b->r_min, b->r_max, i, i, b->b_min, b->b_max)) { b->g_max = i; break; } - for (i = b->b_min; i <= b->b_max; i++) - if (histogram_count(h, b->r_min, b->r_max, b->g_min, b->g_max, i, i)) { b->b_min = i; break; } - for (i = b->b_max; i >= b->b_min; i--) - if (histogram_count(h, b->r_min, b->r_max, b->g_min, b->g_max, i, i)) { b->b_max = i; break; } - b->count = box_count(h, b); - b->score = box_score(b); -} - -/* helper for split_box */ -static inline void set_avg(int *min, int *max) -{ - int avg = (*min + *max) / 2; - *min = avg + 1; - *max = avg; -} - -/* split a box based on the best axis */ -static void split_box(struct histogram *h, struct box *b1, struct box *b2) -{ - int r = ((b1->r_max - b1->r_min) << R_SHIFT) * R_SCALE; - int g = ((b1->g_max - b1->g_min) << G_SHIFT) * G_SCALE; - int b = ((b1->b_max - b1->b_min) << B_SHIFT) * B_SCALE; - - *b2 = *b1; - - if (r > g) - { - if (b > r) set_avg(&b1->b_min, &b2->b_max); - else set_avg(&b1->r_min, &b2->r_max); - } - else - { - if (b > g) set_avg(&b1->b_min, &b2->b_max); - else set_avg(&b1->g_min, &b2->g_max); - } - - shrink_box(h, b1); - shrink_box(h, b2); -} - -/* find box suitable for split based on count */ -static struct box *find_box_max_count(struct box *b, int count) -{ - struct box *best = NULL; - for (; count--; b++) - if (b->score && (!best || b->count > best->count)) best = b; - return best; -} - -/* find box suitable for split based on score */ -static struct box *find_box_max_score(struct box *b, int count) -{ - struct box *best = NULL; - for (; count--; b++) - if (b->score && (!best || b->score > best->score)) best = b; - return best; -} - -/* compute color map with at most 'desired' colors - * image must be in 24bpp BGR format and colors are returned in 0xAARRGGBB format */ -static int median_cut(unsigned char *image, unsigned int width, unsigned int height, - unsigned int stride, int desired, unsigned int *colors) -{ - struct box boxes[256]; - struct histogram *h; - unsigned int x, y; - unsigned char *p; - struct box *b1, *b2; - int numboxes, i; - - if (!(h = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*h)))) - return 0; - - for (y = 0; y < height; y++) - for (x = 0, p = image + y * stride; x < width; x++, p += 3) - h->data[p[2] >> R_SHIFT][p[1] >> G_SHIFT][p[0] >> B_SHIFT]++; - - numboxes = 1; - boxes[0].r_min = 0; boxes[0].r_max = R_COUNT - 1; - boxes[0].g_min = 0; boxes[0].g_max = G_COUNT - 1; - boxes[0].b_min = 0; boxes[0].b_max = B_COUNT - 1; - shrink_box(h, &boxes[0]); - - while (numboxes <= desired / 2) - { - if (!(b1 = find_box_max_count(boxes, numboxes))) break; - b2 = &boxes[numboxes++]; - split_box(h, b1, b2); - } - while (numboxes < desired) - { - if (!(b1 = find_box_max_score(boxes, numboxes))) break; - b2 = &boxes[numboxes++]; - split_box(h, b1, b2); - } - - for (i = 0; i < numboxes; i++) - colors[i] = box_color(h, &boxes[i]); - - HeapFree(GetProcessHeap(), 0, h); - return numboxes; -} - - -static HRESULT WINAPI PaletteImpl_InitializeFromBitmap(IWICPalette *palette, - IWICBitmapSource *source, UINT desired, BOOL add_transparent) +static HRESULT WINAPI PaletteImpl_InitializeFromBitmap(IWICPalette *iface, + IWICBitmapSource *pISurface, UINT colorCount, BOOL fAddTransparentColor) { - IWICImagingFactory *factory = NULL; - IWICBitmap *rgb24_bitmap = NULL; - IWICBitmapSource *rgb24_source; - IWICBitmapLock *lock = NULL; - WICPixelFormatGUID format; - HRESULT hr; - UINT width, height, stride, size, actual_number_of_colors; - BYTE *src; - WICColor colors[256]; - - TRACE("(%p,%p,%u,%d)\n", palette, source, desired, add_transparent); - - if (!source || desired < 2 || desired > 256) - return E_INVALIDARG; - - hr = IWICBitmapSource_GetPixelFormat(source, &format); - if (hr != S_OK) return hr; - - /* For interoperability with gdiplus where PixelFormat24bppRGB actully stored - * as BGR (and there is no a corresponding RGB format) we have to use 24bppBGR - * to avoid format conversions. - */ - if (!IsEqualGUID(&format, &GUID_WICPixelFormat24bppBGR)) - { - hr = WICConvertBitmapSource(&GUID_WICPixelFormat24bppBGR, source, &rgb24_source); - if (hr != S_OK) return hr; - } - else - rgb24_source = source; - - hr = ComponentFactory_CreateInstance(&IID_IWICImagingFactory, (void **)&factory); - if (hr != S_OK) goto fail; - - hr = IWICImagingFactory_CreateBitmapFromSource(factory, rgb24_source, WICBitmapCacheOnLoad, &rgb24_bitmap); - if (hr != S_OK) goto fail; - - hr = IWICBitmap_Lock(rgb24_bitmap, NULL, WICBitmapLockRead, &lock); - if (hr != S_OK) goto fail; - - IWICBitmapLock_GetSize(lock, &width, &height); - IWICBitmapLock_GetStride(lock, &stride); - IWICBitmapLock_GetDataPointer(lock, &size, &src); - - actual_number_of_colors = median_cut(src, width, height, stride, add_transparent ? desired - 1 : desired, colors); - TRACE("actual number of colors: %u\n", actual_number_of_colors); - - if (actual_number_of_colors) - { - if (add_transparent) colors[actual_number_of_colors++] = 0; - - hr = IWICPalette_InitializeCustom(palette, colors, actual_number_of_colors); - } - else - hr = E_OUTOFMEMORY; - -fail: - if (lock) - IWICBitmapLock_Release(lock); - - if (rgb24_bitmap) - IWICBitmap_Release(rgb24_bitmap); - - if (factory) - IWICImagingFactory_Release(factory); - - if (rgb24_source != source) - IWICBitmapSource_Release(rgb24_source); - - return hr; + FIXME("(%p,%p,%u,%i): stub\n", iface, pISurface, colorCount, fAddTransparentColor); + return E_NOTIMPL; }
static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface, diff --git a/dll/win32/windowscodecs/pngformat.c b/dll/win32/windowscodecs/pngformat.c index 175642b295..6946721b77 100644 --- a/dll/win32/windowscodecs/pngformat.c +++ b/dll/win32/windowscodecs/pngformat.c @@ -19,8 +19,6 @@
#include "wincodecs_private.h"
-#include <winerror.h> - #ifdef HAVE_PNG_H #include <png.h> #endif @@ -565,8 +563,6 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p int num_trans; png_uint_32 transparency; png_color_16p trans_values; - png_colorp png_palette; - int num_palette; jmp_buf jmpbuf; BYTE chunk_type[4]; ULONG chunk_size; @@ -609,7 +605,7 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p ppng_destroy_read_struct(&This->png_ptr, &This->info_ptr, &This->end_info); HeapFree(GetProcessHeap(), 0, row_pointers); This->png_ptr = NULL; - hr = WINCODEC_ERR_UNKNOWNIMAGEFORMAT; + hr = E_FAIL; goto end; } ppng_set_error_fn(This->png_ptr, jmpbuf, user_error_fn, user_warning_fn); @@ -633,37 +629,18 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p /* check for color-keyed alpha */ transparency = ppng_get_tRNS(This->png_ptr, This->info_ptr, &trans, &num_trans, &trans_values);
- if (!ppng_get_PLTE(This->png_ptr, This->info_ptr, &png_palette, &num_palette)) - num_palette = 0; - - TRACE("color_type %d, bit_depth %d, transparency %d, num_palette %d\n", - color_type, bit_depth, transparency, num_palette); + if (transparency && (color_type == PNG_COLOR_TYPE_RGB || + (color_type == PNG_COLOR_TYPE_GRAY && bit_depth == 16))) + { + /* expand to RGBA */ + if (color_type == PNG_COLOR_TYPE_GRAY) + ppng_set_gray_to_rgb(This->png_ptr); + ppng_set_tRNS_to_alpha(This->png_ptr); + color_type = PNG_COLOR_TYPE_RGB_ALPHA; + }
switch (color_type) { - case PNG_COLOR_TYPE_GRAY: - This->bpp = bit_depth; - switch (bit_depth) - { - case 1: - This->format = num_palette ? &GUID_WICPixelFormat1bppIndexed : &GUID_WICPixelFormatBlackWhite; - break; - case 2: - This->format = num_palette ? &GUID_WICPixelFormat2bppIndexed : &GUID_WICPixelFormat2bppGray; - break; - case 4: - This->format = num_palette ? &GUID_WICPixelFormat4bppIndexed : &GUID_WICPixelFormat4bppGray; - break; - case 8: - This->format = num_palette ? &GUID_WICPixelFormat8bppIndexed : &GUID_WICPixelFormat8bppGray; - break; - case 16: This->format = &GUID_WICPixelFormat16bppGray; break; - default: - ERR("invalid grayscale bit depth: %i\n", bit_depth); - hr = WINCODEC_ERR_UNKNOWNIMAGEFORMAT; - goto end; - } - break; case PNG_COLOR_TYPE_GRAY_ALPHA: /* WIC does not support grayscale alpha formats so use RGBA */ ppng_set_gray_to_rgb(This->png_ptr); @@ -683,6 +660,25 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p goto end; } break; + case PNG_COLOR_TYPE_GRAY: + This->bpp = bit_depth; + if (!transparency) + { + switch (bit_depth) + { + case 1: This->format = &GUID_WICPixelFormatBlackWhite; break; + case 2: This->format = &GUID_WICPixelFormat2bppGray; break; + case 4: This->format = &GUID_WICPixelFormat4bppGray; break; + case 8: This->format = &GUID_WICPixelFormat8bppGray; break; + case 16: This->format = &GUID_WICPixelFormat16bppGray; break; + default: + ERR("invalid grayscale bit depth: %i\n", bit_depth); + hr = E_FAIL; + goto end; + } + break; + } + /* else fall through */ case PNG_COLOR_TYPE_PALETTE: This->bpp = bit_depth; switch (bit_depth) @@ -840,14 +836,10 @@ static HRESULT WINAPI PngDecoder_CopyPalette(IWICBitmapDecoder *iface, }
static HRESULT WINAPI PngDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, - IWICMetadataQueryReader **reader) + IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, reader); - - if (!reader) return E_INVALIDARG; - - *reader = NULL; - return WINCODEC_ERR_UNSUPPORTEDOPERATION; + FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); + return E_NOTIMPL; }
static HRESULT WINAPI PngDecoder_GetPreview(IWICBitmapDecoder *iface, @@ -1014,7 +1006,7 @@ static HRESULT WINAPI PngDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette) { PngDecoder *This = impl_from_IWICBitmapFrameDecode(iface); - png_uint_32 ret; + png_uint_32 ret, color_type, bit_depth; png_colorp png_palette; int num_palette; WICColor palette[256]; @@ -1028,30 +1020,58 @@ static HRESULT WINAPI PngDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
EnterCriticalSection(&This->lock);
- ret = ppng_get_PLTE(This->png_ptr, This->info_ptr, &png_palette, &num_palette); - if (!ret) - { - hr = WINCODEC_ERR_PALETTEUNAVAILABLE; - goto end; - } + color_type = ppng_get_color_type(This->png_ptr, This->info_ptr); + bit_depth = ppng_get_bit_depth(This->png_ptr, This->info_ptr);
- if (num_palette > 256) + if (color_type == PNG_COLOR_TYPE_PALETTE) { - ERR("palette has %i colors?!\n", num_palette); - hr = E_FAIL; - goto end; + ret = ppng_get_PLTE(This->png_ptr, This->info_ptr, &png_palette, &num_palette); + if (!ret) + { + hr = WINCODEC_ERR_PALETTEUNAVAILABLE; + goto end; + } + + if (num_palette > 256) + { + ERR("palette has %i colors?!\n", num_palette); + hr = E_FAIL; + goto end; + } + + ret = ppng_get_tRNS(This->png_ptr, This->info_ptr, &trans_alpha, &num_trans, &trans_values); + if (!ret) num_trans = 0; + + for (i=0; i<num_palette; i++) + { + BYTE alpha = (i < num_trans) ? trans_alpha[i] : 0xff; + palette[i] = (alpha << 24 | + png_palette[i].red << 16| + png_palette[i].green << 8| + png_palette[i].blue); + } } + else if (color_type == PNG_COLOR_TYPE_GRAY) { + ret = ppng_get_tRNS(This->png_ptr, This->info_ptr, &trans_alpha, &num_trans, &trans_values);
- ret = ppng_get_tRNS(This->png_ptr, This->info_ptr, &trans_alpha, &num_trans, &trans_values); - if (!ret) num_trans = 0; + if (!ret) + { + hr = WINCODEC_ERR_PALETTEUNAVAILABLE; + goto end; + }
- for (i=0; i<num_palette; i++) + num_palette = 1 << bit_depth; + + for (i=0; i<num_palette; i++) + { + BYTE alpha = (i == trans_values[0].gray) ? 0 : 0xff; + BYTE val = i * 255 / (num_palette - 1); + palette[i] = (alpha << 24 | val << 16 | val << 8 | val); + } + } + else { - BYTE alpha = (i < num_trans) ? trans_alpha[i] : 0xff; - palette[i] = (alpha << 24 | - png_palette[i].red << 16| - png_palette[i].green << 8| - png_palette[i].blue); + hr = WINCODEC_ERR_PALETTEUNAVAILABLE; }
end: @@ -1632,31 +1652,22 @@ static HRESULT WINAPI PngFrameEncode_WritePixels(IWICBitmapFrameEncode *iface, /* Newer libpng versions don't accept larger palettes than the declared * bit depth, so we need to generate the palette of the correct length. */ - colors = 1 << This->format->bit_depth; + colors = min(This->colors, 1 << This->format->bit_depth);
for (i = 0; i < colors; i++) { - if (i < This->colors) - { - png_palette[i].red = (This->palette[i] >> 16) & 0xff; - png_palette[i].green = (This->palette[i] >> 8) & 0xff; - png_palette[i].blue = This->palette[i] & 0xff; - trans[i] = (This->palette[i] >> 24) & 0xff; - if (trans[i] != 0xff) - num_trans++; - } - else - { - png_palette[i].red = 0; - png_palette[i].green = 0; - png_palette[i].blue = 0; - } + png_palette[i].red = (This->palette[i] >> 16) & 0xff; + png_palette[i].green = (This->palette[i] >> 8) & 0xff; + png_palette[i].blue = This->palette[i] & 0xff; + trans[i] = (This->palette[i] >> 24) & 0xff; + if (trans[i] != 0xff) + num_trans = i+1; }
ppng_set_PLTE(This->png_ptr, This->info_ptr, png_palette, colors);
if (num_trans) - ppng_set_tRNS(This->png_ptr, This->info_ptr, trans, colors, NULL); + ppng_set_tRNS(This->png_ptr, This->info_ptr, trans, num_trans, NULL); }
ppng_write_info(This->png_ptr, This->info_ptr); @@ -1958,22 +1969,11 @@ static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, return E_NOTIMPL; }
-static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info) +static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, + IWICBitmapEncoderInfo **ppIEncoderInfo) { - IWICComponentInfo *comp_info; - HRESULT hr; - - TRACE("%p,%p\n", iface, info); - - if (!info) return E_INVALIDARG; - - hr = CreateComponentInfo(&CLSID_WICPngEncoder, &comp_info); - if (hr == S_OK) - { - hr = IWICComponentInfo_QueryInterface(comp_info, &IID_IWICBitmapEncoderInfo, (void **)info); - IWICComponentInfo_Release(comp_info); - } - return hr; + FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo); + return E_NOTIMPL; }
static HRESULT WINAPI PngEncoder_SetColorContexts(IWICBitmapEncoder *iface, diff --git a/dll/win32/windowscodecs/regsvr.c b/dll/win32/windowscodecs/regsvr.c index aba6c0a0ee..756fb19651 100644 --- a/dll/win32/windowscodecs/regsvr.c +++ b/dll/win32/windowscodecs/regsvr.c @@ -1194,10 +1194,6 @@ static GUID const * const tiff_decode_formats[] = { &GUID_WICPixelFormatBlackWhite, &GUID_WICPixelFormat4bppGray, &GUID_WICPixelFormat8bppGray, - &GUID_WICPixelFormat16bppGray, - &GUID_WICPixelFormat32bppGrayFloat, - &GUID_WICPixelFormat1bppIndexed, - &GUID_WICPixelFormat2bppIndexed, &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormat24bppBGR, @@ -1207,9 +1203,6 @@ static GUID const * const tiff_decode_formats[] = { &GUID_WICPixelFormat48bppRGB, &GUID_WICPixelFormat64bppRGBA, &GUID_WICPixelFormat64bppPRGBA, - &GUID_WICPixelFormat32bppCMYK, - &GUID_WICPixelFormat64bppCMYK, - &GUID_WICPixelFormat128bppRGBAFloat, NULL };
@@ -1335,11 +1328,6 @@ static GUID const * const bmp_encode_formats[] = { &GUID_WICPixelFormat16bppBGR565, &GUID_WICPixelFormat24bppBGR, &GUID_WICPixelFormat32bppBGR, - &GUID_WICPixelFormatBlackWhite, - &GUID_WICPixelFormat1bppIndexed, - &GUID_WICPixelFormat2bppIndexed, - &GUID_WICPixelFormat4bppIndexed, - &GUID_WICPixelFormat8bppIndexed, NULL };
@@ -1365,10 +1353,6 @@ static GUID const * const tiff_encode_formats[] = { &GUID_WICPixelFormatBlackWhite, &GUID_WICPixelFormat4bppGray, &GUID_WICPixelFormat8bppGray, - &GUID_WICPixelFormat1bppIndexed, - &GUID_WICPixelFormat2bppIndexed, - &GUID_WICPixelFormat4bppIndexed, - &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormat24bppBGR, &GUID_WICPixelFormat32bppBGRA, &GUID_WICPixelFormat32bppPBGRA, @@ -1394,16 +1378,6 @@ static struct regsvr_encoder const encoder_list[] = { ".bmp,.dib,.rle", bmp_encode_formats }, - { &CLSID_WICGifEncoder, - "The Wine Project", - "GIF Encoder", - "1.0.0.0", - &GUID_VendorMicrosoft, - &GUID_ContainerFormatGif, - "image/gif", - ".gif", - gif_formats - }, { &CLSID_WICJpegEncoder, "The Wine Project", "JPEG Encoder", @@ -1463,11 +1437,8 @@ static GUID const * const converter_formats[] = { &GUID_WICPixelFormat24bppBGR, &GUID_WICPixelFormat24bppRGB, &GUID_WICPixelFormat32bppBGR, - &GUID_WICPixelFormat32bppRGB, &GUID_WICPixelFormat32bppBGRA, - &GUID_WICPixelFormat32bppRGBA, &GUID_WICPixelFormat32bppPBGRA, - &GUID_WICPixelFormat32bppPRGBA, &GUID_WICPixelFormat32bppGrayFloat, &GUID_WICPixelFormat48bppRGB, &GUID_WICPixelFormat64bppRGBA, @@ -1739,13 +1710,6 @@ static BYTE const channel_mask_16bit2[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, static BYTE const channel_mask_16bit3[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 }; static BYTE const channel_mask_16bit4[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff };
-static BYTE const channel_mask_32bit[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }; - -static BYTE const channel_mask_128bit1[] = { 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -static BYTE const channel_mask_128bit2[] = { 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -static BYTE const channel_mask_128bit3[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00 }; -static BYTE const channel_mask_128bit4[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff }; - static BYTE const channel_mask_5bit[] = { 0x1f, 0x00 }; static BYTE const channel_mask_5bit2[] = { 0xe0, 0x03 }; static BYTE const channel_mask_5bit3[] = { 0x00, 0x7c }; @@ -1762,9 +1726,6 @@ static BYTE const * const channel_masks_8bit[] = { channel_mask_8bit, static BYTE const * const channel_masks_16bit[] = { channel_mask_16bit, channel_mask_16bit2, channel_mask_16bit3, channel_mask_16bit4};
-static BYTE const * const channel_masks_32bit[] = { channel_mask_32bit }; -static BYTE const * const channel_masks_128bit[] = { channel_mask_128bit1, channel_mask_128bit2, channel_mask_128bit3, channel_mask_128bit4 }; - static BYTE const * const channel_masks_BGRA5551[] = { channel_mask_5bit, channel_mask_5bit2, channel_mask_5bit3, channel_mask_5bit4 };
@@ -1781,7 +1742,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = { 1, /* channel count */ channel_masks_1bit, WICPixelFormatNumericRepresentationIndexed, - 0 + 1 }, { &GUID_WICPixelFormat2bppIndexed, "The Wine Project", @@ -1792,7 +1753,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = { 1, /* channel count */ channel_masks_2bit, WICPixelFormatNumericRepresentationIndexed, - 0 + 1 }, { &GUID_WICPixelFormat4bppIndexed, "The Wine Project", @@ -1803,7 +1764,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = { 1, /* channel count */ channel_masks_4bit, WICPixelFormatNumericRepresentationIndexed, - 0 + 1 }, { &GUID_WICPixelFormat8bppIndexed, "The Wine Project", @@ -1814,7 +1775,7 @@ static struct regsvr_pixelformat const pixelformat_list[] = { 1, /* channel count */ channel_masks_8bit, WICPixelFormatNumericRepresentationIndexed, - 0 + 1 }, { &GUID_WICPixelFormatBlackWhite, "The Wine Project", @@ -1937,17 +1898,6 @@ static struct regsvr_pixelformat const pixelformat_list[] = { WICPixelFormatNumericRepresentationUnsignedInteger, 0 }, - { &GUID_WICPixelFormat32bppRGB, - "The Wine Project", - "32bpp RGB", - NULL, /* no version */ - &GUID_VendorMicrosoft, - 32, /* bitsperpixel */ - 3, /* channel count */ - channel_masks_8bit, - WICPixelFormatNumericRepresentationUnsignedInteger, - 0 - }, { &GUID_WICPixelFormat32bppBGRA, "The Wine Project", "32bpp BGRA", @@ -1959,17 +1909,6 @@ static struct regsvr_pixelformat const pixelformat_list[] = { WICPixelFormatNumericRepresentationUnsignedInteger, 1 }, - { &GUID_WICPixelFormat32bppRGBA, - "The Wine Project", - "32bpp RGBA", - NULL, /* no version */ - &GUID_VendorMicrosoft, - 32, /* bitsperpixel */ - 4, /* channel count */ - channel_masks_8bit, - WICPixelFormatNumericRepresentationUnsignedInteger, - 1 - }, { &GUID_WICPixelFormat32bppPBGRA, "The Wine Project", "32bpp PBGRA", @@ -1981,28 +1920,6 @@ static struct regsvr_pixelformat const pixelformat_list[] = { WICPixelFormatNumericRepresentationUnsignedInteger, 1 }, - { &GUID_WICPixelFormat32bppPRGBA, - "The Wine Project", - "32bpp PRGBA", - NULL, /* no version */ - &GUID_VendorMicrosoft, - 32, /* bitsperpixel */ - 4, /* channel count */ - channel_masks_8bit, - WICPixelFormatNumericRepresentationUnsignedInteger, - 1 - }, - { &GUID_WICPixelFormat32bppGrayFloat, - "The Wine Project", - "32bpp GrayFloat", - NULL, /* no version */ - &GUID_VendorMicrosoft, - 32, /* bitsperpixel */ - 1, /* channel count */ - channel_masks_32bit, - WICPixelFormatNumericRepresentationFloat, - 0 - }, { &GUID_WICPixelFormat48bppRGB, "The Wine Project", "48bpp RGB", @@ -2047,28 +1964,6 @@ static struct regsvr_pixelformat const pixelformat_list[] = { WICPixelFormatNumericRepresentationUnsignedInteger, 0 }, - { &GUID_WICPixelFormat64bppCMYK, - "The Wine Project", - "64bpp CMYK", - NULL, /* no version */ - &GUID_VendorMicrosoft, - 64, /* bitsperpixel */ - 4, /* channel count */ - channel_masks_16bit, - WICPixelFormatNumericRepresentationUnsignedInteger, - 0 - }, - { &GUID_WICPixelFormat128bppRGBAFloat, - "The Wine Project", - "128bpp RGBAFloat", - NULL, /* no version */ - &GUID_VendorMicrosoft, - 128, /* bitsperpixel */ - 4, /* channel count */ - channel_masks_128bit, - WICPixelFormatNumericRepresentationFloat, - 1 - }, { NULL } /* list terminator */ };
diff --git a/dll/win32/windowscodecs/scaler.c b/dll/win32/windowscodecs/scaler.c index a7c2447f53..8e267e314a 100644 --- a/dll/win32/windowscodecs/scaler.c +++ b/dll/win32/windowscodecs/scaler.c @@ -21,7 +21,6 @@ typedef struct BitmapScaler { IWICBitmapScaler IWICBitmapScaler_iface; LONG ref; - IMILBitmapScaler IMILBitmapScaler_iface; IWICBitmapSource *source; UINT width, height; UINT src_width, src_height; @@ -37,11 +36,6 @@ static inline BitmapScaler *impl_from_IWICBitmapScaler(IWICBitmapScaler *iface) return CONTAINING_RECORD(iface, BitmapScaler, IWICBitmapScaler_iface); }
-static inline BitmapScaler *impl_from_IMILBitmapScaler(IMILBitmapScaler *iface) -{ - return CONTAINING_RECORD(iface, BitmapScaler, IMILBitmapScaler_iface); -} - static HRESULT WINAPI BitmapScaler_QueryInterface(IWICBitmapScaler *iface, REFIID iid, void **ppv) { @@ -56,13 +50,8 @@ static HRESULT WINAPI BitmapScaler_QueryInterface(IWICBitmapScaler *iface, REFII { *ppv = &This->IWICBitmapScaler_iface; } - else if (IsEqualIID(&IID_IMILBitmapScaler, iid)) - { - *ppv = &This->IMILBitmapScaler_iface; - } else { - FIXME("unknown interface %s\n", debugstr_guid(iid)); *ppv = NULL; return E_NOINTERFACE; } @@ -371,163 +360,6 @@ static const IWICBitmapScalerVtbl BitmapScaler_Vtbl = { BitmapScaler_Initialize };
-static HRESULT WINAPI IMILBitmapScaler_QueryInterface(IMILBitmapScaler *iface, REFIID iid, - void **ppv) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - - TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); - - if (!ppv) return E_INVALIDARG; - - if (IsEqualIID(&IID_IUnknown, iid) || - IsEqualIID(&IID_IMILBitmapScaler, iid) || - IsEqualIID(&IID_IMILBitmapSource, iid)) - { - IUnknown_AddRef(&This->IMILBitmapScaler_iface); - *ppv = &This->IMILBitmapScaler_iface; - return S_OK; - } - else if (IsEqualIID(&IID_IWICBitmapScaler, iid) || - IsEqualIID(&IID_IWICBitmapSource, iid)) - { - IUnknown_AddRef(&This->IWICBitmapScaler_iface); - *ppv = &This->IWICBitmapScaler_iface; - return S_OK; - } - - FIXME("unknown interface %s\n", debugstr_guid(iid)); - *ppv = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI IMILBitmapScaler_AddRef(IMILBitmapScaler *iface) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - return IWICBitmapScaler_AddRef(&This->IWICBitmapScaler_iface); -} - -static ULONG WINAPI IMILBitmapScaler_Release(IMILBitmapScaler *iface) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - return IWICBitmapScaler_Release(&This->IWICBitmapScaler_iface); -} - -static HRESULT WINAPI IMILBitmapScaler_GetSize(IMILBitmapScaler *iface, - UINT *width, UINT *height) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - - TRACE("(%p,%p,%p)\n", iface, width, height); - - if (!This->source) - return WINCODEC_ERR_NOTINITIALIZED; - - return IWICBitmapScaler_GetSize(&This->IWICBitmapScaler_iface, width, height); -} - -static HRESULT WINAPI IMILBitmapScaler_GetPixelFormat(IMILBitmapScaler *iface, - int *format) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - IMILBitmapSource *source; - HRESULT hr; - - TRACE("(%p,%p)\n", iface, format); - - if (!format) return E_INVALIDARG; - - if (!This->source) - return WINCODEC_ERR_NOTINITIALIZED; - - hr = IWICBitmapSource_QueryInterface(This->source, &IID_IMILBitmapSource, (void **)&source); - if (hr == S_OK) - { - hr = source->lpVtbl->GetPixelFormat(source, format); - source->lpVtbl->Release(source); - } - return hr; -} - -static HRESULT WINAPI IMILBitmapScaler_GetResolution(IMILBitmapScaler *iface, - double *dpix, double *dpiy) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - - TRACE("(%p,%p,%p)\n", iface, dpix, dpiy); - - if (!This->source) - return WINCODEC_ERR_NOTINITIALIZED; - - return IWICBitmapScaler_GetResolution(&This->IWICBitmapScaler_iface, dpix, dpiy); -} - -static HRESULT WINAPI IMILBitmapScaler_CopyPalette(IMILBitmapScaler *iface, - IWICPalette *palette) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - - TRACE("(%p,%p)\n", iface, palette); - - if (!This->source) - return WINCODEC_ERR_NOTINITIALIZED; - - return IWICBitmapScaler_CopyPalette(&This->IWICBitmapScaler_iface, palette); -} - -static HRESULT WINAPI IMILBitmapScaler_CopyPixels(IMILBitmapScaler *iface, - const WICRect *rc, UINT stride, UINT size, BYTE *buffer) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - - TRACE("(%p,%p,%u,%u,%p)\n", iface, rc, stride, size, buffer); - - if (!This->source) - return WINCODEC_ERR_NOTINITIALIZED; - - return IWICBitmapScaler_CopyPixels(&This->IWICBitmapScaler_iface, rc, stride, size, buffer); -} - -static HRESULT WINAPI IMILBitmapScaler_unknown1(IMILBitmapScaler *iface, void **ppv) -{ - TRACE("(%p,%p)\n", iface, ppv); - return E_NOINTERFACE; -} - -static HRESULT WINAPI IMILBitmapScaler_Initialize(IMILBitmapScaler *iface, - IMILBitmapSource *mil_source, UINT width, UINT height, - WICBitmapInterpolationMode mode) -{ - BitmapScaler *This = impl_from_IMILBitmapScaler(iface); - IWICBitmapSource *wic_source; - HRESULT hr; - - TRACE("(%p,%p,%u,%u,%u)\n", iface, mil_source, width, height, mode); - - if (!mil_source) return E_INVALIDARG; - - hr = mil_source->lpVtbl->QueryInterface(mil_source, &IID_IWICBitmapSource, (void **)&wic_source); - if (hr == S_OK) - { - hr = IWICBitmapScaler_Initialize(&This->IWICBitmapScaler_iface, wic_source, width, height, mode); - IWICBitmapSource_Release(wic_source); - } - return hr; -} - -static const IMILBitmapScalerVtbl IMILBitmapScaler_Vtbl = { - IMILBitmapScaler_QueryInterface, - IMILBitmapScaler_AddRef, - IMILBitmapScaler_Release, - IMILBitmapScaler_GetSize, - IMILBitmapScaler_GetPixelFormat, - IMILBitmapScaler_GetResolution, - IMILBitmapScaler_CopyPalette, - IMILBitmapScaler_CopyPixels, - IMILBitmapScaler_unknown1, - IMILBitmapScaler_Initialize -}; - HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) { BitmapScaler *This; @@ -536,7 +368,6 @@ HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) if (!This) return E_OUTOFMEMORY;
This->IWICBitmapScaler_iface.lpVtbl = &BitmapScaler_Vtbl; - This->IMILBitmapScaler_iface.lpVtbl = &IMILBitmapScaler_Vtbl; This->ref = 1; This->source = NULL; This->width = 0; diff --git a/dll/win32/windowscodecs/tiffformat.c b/dll/win32/windowscodecs/tiffformat.c index 740de4955b..55423028a4 100644 --- a/dll/win32/windowscodecs/tiffformat.c +++ b/dll/win32/windowscodecs/tiffformat.c @@ -1,6 +1,5 @@ /* * Copyright 2010 Vincent Povirk for CodeWeavers - * Copyright 2016 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -304,8 +303,6 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info) } decode_info->planar = planar;
- TRACE("planar %u, photometric %u, samples %u, bps %u\n", planar, photometric, samples, bps); - switch(photometric) { case 0: /* WhiteIsZero */ @@ -370,28 +367,14 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info) } } break; - case 16: - if (samples != 1) - { - FIXME("unhandled 16bpp grayscale sample count %u\n", samples); - return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; - } - decode_info->format = &GUID_WICPixelFormat16bppGray; - break; - case 32: - if (samples != 1) - { - FIXME("unhandled 32bpp grayscale sample count %u\n", samples); - return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; - } - decode_info->format = &GUID_WICPixelFormat32bppGrayFloat; - break; default: - WARN("unhandled greyscale bit count %u\n", bps); - return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; + FIXME("unhandled greyscale bit count %u\n", bps); + return E_FAIL; } break; case 2: /* RGB */ + decode_info->bpp = bps * samples; + if (samples == 4) { ret = pTIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_sample_count, &extra_samples); @@ -408,12 +391,8 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info) return E_FAIL; }
- decode_info->bpp = max(bps, 8) * samples; - decode_info->source_bpp = bps * samples; switch(bps) { - case 1: - case 4: case 8: decode_info->reverse_bgr = 1; if (samples == 3) @@ -451,17 +430,9 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info) return E_FAIL; } break; - case 32: - if (samples != 4) - { - FIXME("unhandled 32bpp RGB sample count %u\n", samples); - return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; - } - decode_info->format = &GUID_WICPixelFormat128bppRGBAFloat; - break; default: - WARN("unhandled RGB bit count %u\n", bps); - return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; + FIXME("unhandled RGB bit count %u\n", bps); + return E_FAIL; } break; case 3: /* RGB Palette */ @@ -475,12 +446,6 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info) decode_info->bpp = bps; switch (bps) { - case 1: - decode_info->format = &GUID_WICPixelFormat1bppIndexed; - break; - case 2: - decode_info->format = &GUID_WICPixelFormat2bppIndexed; - break; case 4: decode_info->format = &GUID_WICPixelFormat4bppIndexed; break; @@ -492,31 +457,8 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info) return E_FAIL; } break; - - case 5: /* Separated */ - if (samples != 4) - { - FIXME("unhandled Separated sample count %u\n", samples); - return E_FAIL; - } - - decode_info->bpp = bps * samples; - switch(bps) - { - case 8: - decode_info->format = &GUID_WICPixelFormat32bppCMYK; - break; - case 16: - decode_info->format = &GUID_WICPixelFormat64bppCMYK; - break; - - default: - WARN("unhandled Separated bit count %u\n", bps); - return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT; - } - break; - case 4: /* Transparency mask */ + case 5: /* CMYK */ case 6: /* YCbCr */ case 8: /* CIELab */ default: @@ -667,7 +609,6 @@ static HRESULT WINAPI TiffDecoder_Initialize(IWICBitmapDecoder *iface, IStream * { TiffDecoder *This = impl_from_IWICBitmapDecoder(iface); TIFF *tiff; - tiff_decode_info decode_info; HRESULT hr=S_OK;
TRACE("(%p,%p,%x)\n", iface, pIStream, cacheOptions); @@ -681,20 +622,13 @@ static HRESULT WINAPI TiffDecoder_Initialize(IWICBitmapDecoder *iface, IStream * }
tiff = tiff_open_stream(pIStream, "r"); + if (!tiff) { hr = E_FAIL; goto exit; }
- /* make sure that TIFF format is supported */ - hr = tiff_get_decode_info(tiff, &decode_info); - if (hr != S_OK) - { - pTIFFClose(tiff); - goto exit; - } - This->tiff = tiff; This->stream = pIStream; IStream_AddRef(pIStream); @@ -743,12 +677,8 @@ static HRESULT WINAPI TiffDecoder_CopyPalette(IWICBitmapDecoder *iface, static HRESULT WINAPI TiffDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); - - if (!ppIMetadataQueryReader) return E_INVALIDARG; - - *ppIMetadataQueryReader = NULL; - return WINCODEC_ERR_UNSUPPORTEDOPERATION; + FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); + return E_NOTIMPL; }
static HRESULT WINAPI TiffDecoder_GetPreview(IWICBitmapDecoder *iface, @@ -1010,183 +940,34 @@ static HRESULT WINAPI TiffFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT tile_y) { + HRESULT hr=S_OK; tsize_t ret; int swap_bytes;
swap_bytes = pTIFFIsByteSwapped(This->parent->tiff);
ret = pTIFFSetDirectory(This->parent->tiff, This->index); - if (ret == -1) - return E_FAIL; - - if (This->decode_info.tiled) - ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y * This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size); - else - ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y, This->cached_tile, This->decode_info.tile_size);
if (ret == -1) - return E_FAIL; + hr = E_FAIL;
- /* 3bpp RGB */ - if (This->decode_info.source_bpp == 3 && This->decode_info.samples == 3 && This->decode_info.bpp == 24) + if (hr == S_OK) { - BYTE *srcdata, *src, *dst; - DWORD x, y, count, width_bytes = (This->decode_info.tile_width * 3 + 7) / 8; - - count = width_bytes * This->decode_info.tile_height; - - srcdata = HeapAlloc(GetProcessHeap(), 0, count); - if (!srcdata) return E_OUTOFMEMORY; - memcpy(srcdata, This->cached_tile, count); - - for (y = 0; y < This->decode_info.tile_height; y++) + if (This->decode_info.tiled) { - src = srcdata + y * width_bytes; - dst = This->cached_tile + y * This->decode_info.tile_width * 3; - - for (x = 0; x < This->decode_info.tile_width; x += 8) - { - dst[2] = (src[0] & 0x80) ? 0xff : 0; /* R */ - dst[1] = (src[0] & 0x40) ? 0xff : 0; /* G */ - dst[0] = (src[0] & 0x20) ? 0xff : 0; /* B */ - if (x + 1 < This->decode_info.tile_width) - { - dst[5] = (src[0] & 0x10) ? 0xff : 0; /* R */ - dst[4] = (src[0] & 0x08) ? 0xff : 0; /* G */ - dst[3] = (src[0] & 0x04) ? 0xff : 0; /* B */ - } - if (x + 2 < This->decode_info.tile_width) - { - dst[8] = (src[0] & 0x02) ? 0xff : 0; /* R */ - dst[7] = (src[0] & 0x01) ? 0xff : 0; /* G */ - dst[6] = (src[1] & 0x80) ? 0xff : 0; /* B */ - } - if (x + 3 < This->decode_info.tile_width) - { - dst[11] = (src[1] & 0x40) ? 0xff : 0; /* R */ - dst[10] = (src[1] & 0x20) ? 0xff : 0; /* G */ - dst[9] = (src[1] & 0x10) ? 0xff : 0; /* B */ - } - if (x + 4 < This->decode_info.tile_width) - { - dst[14] = (src[1] & 0x08) ? 0xff : 0; /* R */ - dst[13] = (src[1] & 0x04) ? 0xff : 0; /* G */ - dst[12] = (src[1] & 0x02) ? 0xff : 0; /* B */ - } - if (x + 5 < This->decode_info.tile_width) - { - dst[17] = (src[1] & 0x01) ? 0xff : 0; /* R */ - dst[16] = (src[2] & 0x80) ? 0xff : 0; /* G */ - dst[15] = (src[2] & 0x40) ? 0xff : 0; /* B */ - } - if (x + 6 < This->decode_info.tile_width) - { - dst[20] = (src[2] & 0x20) ? 0xff : 0; /* R */ - dst[19] = (src[2] & 0x10) ? 0xff : 0; /* G */ - dst[18] = (src[2] & 0x08) ? 0xff : 0; /* B */ - } - if (x + 7 < This->decode_info.tile_width) - { - dst[23] = (src[2] & 0x04) ? 0xff : 0; /* R */ - dst[22] = (src[2] & 0x02) ? 0xff : 0; /* G */ - dst[21] = (src[2] & 0x01) ? 0xff : 0; /* B */ - } - src += 3; - dst += 24; - } + ret = pTIFFReadEncodedTile(This->parent->tiff, tile_x + tile_y * This->decode_info.tiles_across, This->cached_tile, This->decode_info.tile_size); } - - HeapFree(GetProcessHeap(), 0, srcdata); - } - /* 12bpp RGB */ - else if (This->decode_info.source_bpp == 12 && This->decode_info.samples == 3 && This->decode_info.bpp == 24) - { - BYTE *srcdata, *src, *dst; - DWORD x, y, count, width_bytes = (This->decode_info.tile_width * 12 + 7) / 8; - - count = width_bytes * This->decode_info.tile_height; - - srcdata = HeapAlloc(GetProcessHeap(), 0, count); - if (!srcdata) return E_OUTOFMEMORY; - memcpy(srcdata, This->cached_tile, count); - - for (y = 0; y < This->decode_info.tile_height; y++) + else { - src = srcdata + y * width_bytes; - dst = This->cached_tile + y * This->decode_info.tile_width * 3; - - for (x = 0; x < This->decode_info.tile_width; x += 2) - { - dst[0] = ((src[1] & 0xf0) >> 4) * 17; /* B */ - dst[1] = (src[0] & 0x0f) * 17; /* G */ - dst[2] = ((src[0] & 0xf0) >> 4) * 17; /* R */ - if (x + 1 < This->decode_info.tile_width) - { - dst[5] = (src[1] & 0x0f) * 17; /* B */ - dst[4] = ((src[2] & 0xf0) >> 4) * 17; /* G */ - dst[3] = (src[2] & 0x0f) * 17; /* R */ - } - src += 3; - dst += 6; - } + ret = pTIFFReadEncodedStrip(This->parent->tiff, tile_y, This->cached_tile, This->decode_info.tile_size); }
- HeapFree(GetProcessHeap(), 0, srcdata); - } - /* 4bpp RGBA */ - else if (This->decode_info.source_bpp == 4 && This->decode_info.samples == 4 && This->decode_info.bpp == 32) - { - BYTE *src, *dst; - DWORD count; - - /* 1 source byte expands to 2 BGRA samples */ - count = (This->decode_info.tile_width * This->decode_info.tile_height + 1) / 2; - - src = This->cached_tile + count - 1; - dst = This->cached_tile + This->decode_info.tile_size; - - while (count--) - { - BYTE b = *src--; - - dst -= 8; - dst[2] = (b & 0x80) ? 0xff : 0; /* R */ - dst[1] = (b & 0x40) ? 0xff : 0; /* G */ - dst[0] = (b & 0x20) ? 0xff : 0; /* B */ - dst[3] = (b & 0x10) ? 0xff : 0; /* A */ - dst[6] = (b & 0x08) ? 0xff : 0; /* R */ - dst[5] = (b & 0x04) ? 0xff : 0; /* G */ - dst[4] = (b & 0x02) ? 0xff : 0; /* B */ - dst[7] = (b & 0x01) ? 0xff : 0; /* A */ - } + if (ret == -1) + hr = E_FAIL; } - /* 16bpp RGBA */ - else if (This->decode_info.source_bpp == 16 && This->decode_info.samples == 4 && This->decode_info.bpp == 32) - { - BYTE *src, *dst; - DWORD count = This->decode_info.tile_width * This->decode_info.tile_height;
- src = This->cached_tile + count * 2; - dst = This->cached_tile + This->decode_info.tile_size; - - while (count--) - { - BYTE b[2]; - - src -= 2; - dst -= 4; - - b[0] = src[0]; - b[1] = src[1]; - - dst[0] = ((b[1] & 0xf0) >> 4) * 17; /* B */ - dst[1] = (b[0] & 0x0f) * 17; /* G */ - dst[2] = ((b[0] & 0xf0) >> 4) * 17; /* R */ - dst[3] = (b[1] & 0x0f) * 17; /* A */ - } - } /* 8bpp grayscale with extra alpha */ - else if (This->decode_info.source_bpp == 16 && This->decode_info.samples == 2 && This->decode_info.bpp == 32) + if (hr == S_OK && This->decode_info.source_bpp == 16 && This->decode_info.samples == 2 && This->decode_info.bpp == 32) { BYTE *src; DWORD *dst, count = This->decode_info.tile_width * This->decode_info.tile_height; @@ -1201,7 +982,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT } }
- if (This->decode_info.reverse_bgr) + if (hr == S_OK && This->decode_info.reverse_bgr) { if (This->decode_info.bps == 8) { @@ -1212,7 +993,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT } }
- if (swap_bytes && This->decode_info.bps > 8) + if (hr == S_OK && swap_bytes && This->decode_info.bps > 8) { UINT row, i, samples_per_row; BYTE *sample, temp; @@ -1240,7 +1021,7 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT } }
- if (This->decode_info.invert_grayscale) + if (hr == S_OK && This->decode_info.invert_grayscale) { BYTE *byte, *end;
@@ -1256,10 +1037,13 @@ static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT *byte = ~(*byte); }
- This->cached_tile_x = tile_x; - This->cached_tile_y = tile_y; + if (hr == S_OK) + { + This->cached_tile_x = tile_x; + This->cached_tile_y = tile_y; + }
- return S_OK; + return hr; }
static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, @@ -1296,7 +1080,7 @@ static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, if (cbStride < bytesperrow) return E_INVALIDARG;
- if ((cbStride * (prc->Height-1)) + ((prc->Width * This->decode_info.bpp) + 7)/8 > cbBufferSize) + if ((cbStride * prc->Height) > cbBufferSize) return E_INVALIDARG;
min_tile_x = prc->X / This->decode_info.tile_width; @@ -1610,10 +1394,6 @@ static const struct tiff_encode_format formats[] = { {&GUID_WICPixelFormat48bppRGB, 2, 16, 3, 48, 0, 0, 0}, {&GUID_WICPixelFormat64bppRGBA, 2, 16, 4, 64, 1, 2, 0}, {&GUID_WICPixelFormat64bppPRGBA, 2, 16, 4, 64, 1, 1, 0}, - {&GUID_WICPixelFormat1bppIndexed, 3, 1, 1, 1, 0, 0, 0}, - {&GUID_WICPixelFormat2bppIndexed, 3, 2, 1, 2, 0, 0, 0}, - {&GUID_WICPixelFormat4bppIndexed, 3, 4, 1, 4, 0, 0, 0}, - {&GUID_WICPixelFormat8bppIndexed, 3, 8, 1, 8, 0, 0, 0}, {0} };
@@ -1896,21 +1676,6 @@ static HRESULT WINAPI TiffFrameEncode_WritePixels(IWICBitmapFrameEncode *iface, pTIFFSetField(This->parent->tiff, TIFFTAG_YRESOLUTION, (float)This->yres); }
- if (This->format->bpp <= 8 && This->colors && !IsEqualGUID(This->format->guid, &GUID_WICPixelFormatBlackWhite)) - { - uint16 red[256], green[256], blue[256]; - UINT i; - - for (i = 0; i < This->colors; i++) - { - red[i] = (This->palette[i] >> 8) & 0xff00; - green[i] = This->palette[i] & 0xff00; - blue[i] = (This->palette[i] << 8) & 0xff00; - } - - pTIFFSetField(This->parent->tiff, TIFFTAG_COLORMAP, red, green, blue); - } - This->info_written = TRUE; }
@@ -2109,22 +1874,11 @@ static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface, return S_OK; }
-static HRESULT WINAPI TiffEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info) +static HRESULT WINAPI TiffEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, + IWICBitmapEncoderInfo **ppIEncoderInfo) { - IWICComponentInfo *comp_info; - HRESULT hr; - - TRACE("%p,%p\n", iface, info); - - if (!info) return E_INVALIDARG; - - hr = CreateComponentInfo(&CLSID_WICTiffEncoder, &comp_info); - if (hr == S_OK) - { - hr = IWICComponentInfo_QueryInterface(comp_info, &IID_IWICBitmapEncoderInfo, (void **)info); - IWICComponentInfo_Release(comp_info); - } - return hr; + FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo); + return E_NOTIMPL; }
static HRESULT WINAPI TiffEncoder_SetColorContexts(IWICBitmapEncoder *iface, @@ -2184,7 +1938,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface, hr = E_FAIL; }
- if (SUCCEEDED(hr) && ppIEncoderOptions) + if (SUCCEEDED(hr)) { PROPBAG2 opts[2]= {{0}}; opts[0].pstrName = (LPOLESTR)wszTiffCompressionMethod; @@ -2202,7 +1956,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface, VARIANT v; VariantInit(&v); V_VT(&v) = VT_UI1; - V_UI1(&v) = WICTiffCompressionDontCare; + V_UNION(&v, bVal) = WICTiffCompressionDontCare; hr = IPropertyBag2_Write(*ppIEncoderOptions, 1, opts, &v); VariantClear(&v); if (FAILED(hr)) @@ -2244,7 +1998,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface, else hr = E_OUTOFMEMORY;
- if (FAILED(hr) && ppIEncoderOptions) + if (FAILED(hr)) { IPropertyBag2_Release(*ppIEncoderOptions); *ppIEncoderOptions = NULL; diff --git a/dll/win32/windowscodecs/wincodecs_private.h b/dll/win32/windowscodecs/wincodecs_private.h index 96ee8fd069..99daf093ad 100644 --- a/dll/win32/windowscodecs/wincodecs_private.h +++ b/dll/win32/windowscodecs/wincodecs_private.h @@ -55,13 +55,7 @@ DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47
DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a);
-DEFINE_GUID(IID_IMILBitmap,0xb1784d3f,0x8115,0x4763,0x13,0xaa,0x32,0xed,0xdb,0x68,0x29,0x4a); DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); -DEFINE_GUID(IID_IMILBitmapLock,0xa67b2b53,0x8fa1,0x4155,0x8f,0x64,0x0c,0x24,0x7a,0x8f,0x84,0xcd); -DEFINE_GUID(IID_IMILBitmapScaler,0xa767b0f0,0x1c8c,0x4aef,0x56,0x8f,0xad,0xf9,0x6d,0xcf,0xd5,0xcb); -DEFINE_GUID(IID_IMILFormatConverter,0x7e2a746f,0x25c5,0x4851,0xb3,0xaf,0x44,0x3b,0x79,0x63,0x9e,0xc0); -DEFINE_GUID(IID_IMILPalette,0xca8e206f,0xf22c,0x4af7,0x6f,0xba,0x7b,0xed,0x5e,0xb1,0xc9,0x2f); - #define INTERFACE IMILBitmapSource DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) { @@ -69,58 +63,16 @@ DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - /*** IWICBitmapSource methods ***/ - STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE; - STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE; - STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE; - STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE; - STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE; /*** IMILBitmapSource methods ***/ - STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE; - STDMETHOD_(HRESULT,Lock)(THIS_ const WICRect *,DWORD,IWICBitmapLock **) PURE; - STDMETHOD_(HRESULT,Unlock)(THIS_ IWICBitmapLock *) PURE; - STDMETHOD_(HRESULT,SetPalette)(THIS_ IWICPalette *) PURE; - STDMETHOD_(HRESULT,SetResolution)(THIS_ double,double) PURE; - STDMETHOD_(HRESULT,AddDirtyRect)(THIS_ const WICRect *) PURE; + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *); + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *); + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *); + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *); + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *); + STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void **); }; #undef INTERFACE
-#define INTERFACE IMILBitmapScaler -DECLARE_INTERFACE_(IMILBitmapScaler,IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; - /*** IWICBitmapSource methods ***/ - STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE; - STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE; - STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE; - STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE; - STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE; - /*** IMILBitmapScaler methods ***/ - STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE; - STDMETHOD_(HRESULT,Initialize)(THIS_ IMILBitmapSource *,UINT,UINT,WICBitmapInterpolationMode); -}; -#undef INTERFACE - -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#define THISCALL(func) __thiscall_ ## func -#define DEFINE_THISCALL_WRAPPER(func,args) \ - extern typeof(func) THISCALL(func); \ - __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) -#else /* __i386__ */ - -#define THISCALL(func) func -#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ - -#endif /* __i386__ */ - #define INTERFACE IMILUnknown1 DECLARE_INTERFACE_(IMILUnknown1,IUnknown) { @@ -128,19 +80,6 @@ DECLARE_INTERFACE_(IMILUnknown1,IUnknown) STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - /*** thiscall method ***/ - STDMETHOD_(void,unknown1)(THIS_ void*) PURE; - /*** stdcall ***/ - STDMETHOD_(HRESULT,unknown2)(THIS_ void*, void*) PURE; - /*** thiscall method ***/ - STDMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE; - /*** stdcall ***/ - STDMETHOD_(HRESULT,unknown4)(THIS_ void*) PURE; - STDMETHOD_(HRESULT,unknown5)(THIS_ void*) PURE; - STDMETHOD_(HRESULT,unknown6)(THIS_ DWORD64) PURE; - STDMETHOD_(HRESULT,unknown7)(THIS_ void*) PURE; - /*** thiscall method ***/ - STDMETHOD_(HRESULT,unknown8)(THIS) PURE; }; #undef INTERFACE
@@ -152,9 +91,7 @@ DECLARE_INTERFACE_(IMILUnknown2,IUnknown) STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** unknown methods ***/ - STDMETHOD_(HRESULT,unknown1)(THIS_ void *,void **) PURE; - STDMETHOD_(HRESULT,unknown2)(THIS_ void *,void *) PURE; - STDMETHOD_(HRESULT,unknown3)(THIS_ void *) PURE; + STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void *, void *) PURE; }; #undef INTERFACE
@@ -169,7 +106,6 @@ extern HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN extern HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT DibDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT GifDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT GifEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; diff --git a/dll/win32/windowscodecs/windowscodecs.spec b/dll/win32/windowscodecs/windowscodecs.spec index 424b3075ce..8fd2470f11 100644 --- a/dll/win32/windowscodecs/windowscodecs.spec +++ b/dll/win32/windowscodecs/windowscodecs.spec @@ -105,8 +105,7 @@ @ stdcall IWICStream_InitializeFromIStream_Proxy(ptr ptr) IWICStream_InitializeFromIStream_Proxy_W @ stdcall IWICStream_InitializeFromMemory_Proxy(ptr ptr long) IWICStream_InitializeFromMemory_Proxy_W @ stdcall WICConvertBitmapSource(ptr ptr ptr) -@ stdcall WICCreateBitmapFromSection(long long ptr long long long ptr) -@ stdcall WICCreateBitmapFromSectionEx(long long ptr long long long long ptr) +@ stdcall -stub WICCreateBitmapFromSection(long long ptr long long long ptr) @ stdcall WICCreateColorContext_Proxy(ptr ptr) @ stdcall WICCreateImagingFactory_Proxy(long ptr) @ stub WICGetMetadataContentSize diff --git a/dll/win32/windowscodecs/windowscodecs_wincodec.idl b/dll/win32/windowscodecs/windowscodecs_wincodec.idl index fec63d04e1..33c0d4a580 100644 --- a/dll/win32/windowscodecs/windowscodecs_wincodec.idl +++ b/dll/win32/windowscodecs/windowscodecs_wincodec.idl @@ -76,13 +76,6 @@ coclass WICBmpEncoder { interface IWICBitmapEncoder; } ] coclass WICGifDecoder { interface IWICBitmapDecoder; }
-[ - helpstring("WIC GIF Encoder"), - threading(both), - uuid(114f5598-0b22-40a0-86a1-c83ea495adbd) -] -coclass WICGifEncoder { interface IWICBitmapEncoder; } - [ helpstring("WIC ICO Decoder"), threading(both), diff --git a/media/doc/README.WINE b/media/doc/README.WINE index b94e76dc58..d1c733260d 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -196,7 +196,7 @@ reactos/dll/win32/version # Synced to Wine-3.0 reactos/dll/win32/vssapi # Synced to WineStaging-2.9 reactos/dll/win32/wbemdisp # Synced to Wine-3.0 reactos/dll/win32/wbemprox # Synced to Wine-3.0 -reactos/dll/win32/windowscodecs # Synced to WineStaging-2.16 +reactos/dll/win32/windowscodecs # Synced to Wine-3.0 reactos/dll/win32/windowscodecsext # Synced to WineStaging-2.9 reactos/dll/win32/winemp3.acm # Synced to WineStaging-2.16 reactos/dll/win32/wing32 # Synced to WineStaging-2.9