Added patch for initial implementation of GIF encoder in windowscodecs.

This commit is contained in:
Sebastian Lackner 2016-10-16 16:01:02 +02:00
parent 36d0a71019
commit 97e7c4ffaa
10 changed files with 1423 additions and 0 deletions

View File

@ -349,6 +349,7 @@ patch_enable_all ()
enable_wbemdisp_Printer="$1"
enable_widl_SLTG_Typelib_Support="$1"
enable_windowscodecs_32bppGrayFloat="$1"
enable_windowscodecs_GIF_Encoder="$1"
enable_windowscodecs_IMILBitmapSource="$1"
enable_windowscodecs_IWICPalette_InitializeFromBitmap="$1"
enable_windowscodecs_Palette_Images="$1"
@ -1229,6 +1230,9 @@ patch_enable ()
windowscodecs-32bppGrayFloat)
enable_windowscodecs_32bppGrayFloat="$2"
;;
windowscodecs-GIF_Encoder)
enable_windowscodecs_GIF_Encoder="$2"
;;
windowscodecs-IMILBitmapSource)
enable_windowscodecs_IMILBitmapSource="$2"
;;
@ -7197,6 +7201,34 @@ if test "$enable_windowscodecs_32bppGrayFloat" -eq 1; then
) >> "$patchlist"
fi
# Patchset windowscodecs-GIF_Encoder
# |
# | Modified files:
# | * dlls/windowscodecs/bmpencode.c, dlls/windowscodecs/clsfactory.c, dlls/windowscodecs/gifformat.c,
# | dlls/windowscodecs/info.c, dlls/windowscodecs/jpegformat.c, dlls/windowscodecs/regsvr.c,
# | dlls/windowscodecs/tiffformat.c, dlls/windowscodecs/wincodecs_private.h
# |
if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
patch_apply windowscodecs-GIF_Encoder/0001-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
patch_apply windowscodecs-GIF_Encoder/0002-windowscodecs-Implement-IWICBitmapEncoderInfo-GetFil.patch
patch_apply windowscodecs-GIF_Encoder/0003-windowscodecs-Implement-IWICBitmapFrameEncode-SetPal.patch
patch_apply windowscodecs-GIF_Encoder/0004-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
patch_apply windowscodecs-GIF_Encoder/0005-windowscodecs-Avoid-crashing-if-no-IPropertyBag2-was.patch
patch_apply windowscodecs-GIF_Encoder/0006-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
patch_apply windowscodecs-GIF_Encoder/0007-windowscodecs-Avoid-crashing-if-no-IPropertyBag2-was.patch
patch_apply windowscodecs-GIF_Encoder/0008-windowscodecs-Add-initial-implementation-of-the-GIF-.patch
(
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in BMP encoder.", 1 },';
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoderInfo::GetFileExtensions.", 1 },';
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapFrameEncode::SetPalette in JPEG encoder,.", 1 },';
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in JPEG encoder.", 1 },';
echo '+ { "Dmitry Timoshkov", "windowscodecs: Avoid crashing if no IPropertyBag2 was passed to IWICBitmapEncoder::CreateNewFrame in JPEG encoder.", 1 },';
echo '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in TIFF encoder.", 1 },';
echo '+ { "Dmitry Timoshkov", "windowscodecs: Avoid crashing if no IPropertyBag2 was passed to IWICBitmapEncoder::CreateNewFrame in TIFF encoder.", 1 },';
echo '+ { "Dmitry Timoshkov", "windowscodecs: Add initial implementation of the GIF encoder.", 1 },';
) >> "$patchlist"
fi
# Patchset windowscodecs-IMILBitmapSource
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,44 @@
From c79b0e20ed84142dd3652d4f1e08abc8b13a9f8b Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 16 Oct 2016 21:06:32 +0800
Subject: windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in BMP
encoder.
---
dlls/windowscodecs/bmpencode.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c
index 3dce8bb..8bb5c10 100644
--- a/dlls/windowscodecs/bmpencode.c
+++ b/dlls/windowscodecs/bmpencode.c
@@ -451,11 +451,22 @@ static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
return S_OK;
}
-static HRESULT WINAPI BmpEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
- IWICBitmapEncoderInfo **ppIEncoderInfo)
+static HRESULT WINAPI BmpEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info)
{
- FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo);
- return E_NOTIMPL;
+ 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;
}
static HRESULT WINAPI BmpEncoder_SetColorContexts(IWICBitmapEncoder *iface,
--
2.9.0

View File

@ -0,0 +1,31 @@
From 1977ebd81ff7f7023daf00ae7eecee1c8f2e7260 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 16 Oct 2016 17:30:39 +0800
Subject: windowscodecs: Implement IWICBitmapEncoderInfo::GetFileExtensions.
---
dlls/windowscodecs/info.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
index 84b80bc..1a93491 100644
--- a/dlls/windowscodecs/info.c
+++ b/dlls/windowscodecs/info.c
@@ -868,8 +868,12 @@ static HRESULT WINAPI BitmapEncoderInfo_GetMimeTypes(IWICBitmapEncoderInfo *ifac
static HRESULT WINAPI BitmapEncoderInfo_GetFileExtensions(IWICBitmapEncoderInfo *iface,
UINT cchFileExtensions, WCHAR *wzFileExtensions, UINT *pcchActual)
{
- FIXME("(%p,%u,%p,%p): stub\n", iface, cchFileExtensions, wzFileExtensions, pcchActual);
- return E_NOTIMPL;
+ 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);
}
static HRESULT WINAPI BitmapEncoderInfo_DoesSupportAnimation(IWICBitmapEncoderInfo *iface,
--
2.9.0

View File

@ -0,0 +1,62 @@
From 69942a5f16dff9ea123fd9e8819cde00c7fbf3ae Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 16 Oct 2016 17:32:48 +0800
Subject: windowscodecs: Implement IWICBitmapFrameEncode::SetPalette in JPEG
encoder,
---
dlls/windowscodecs/jpegformat.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index b7998be..9ec64e7 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -861,6 +861,8 @@ typedef struct JpegEncoder {
double xres, yres;
const jpeg_compress_format *format;
IStream *stream;
+ WICColor palette[256];
+ UINT colors;
CRITICAL_SECTION lock;
BYTE dest_buffer[1024];
} JpegEncoder;
@@ -1063,10 +1065,24 @@ static HRESULT WINAPI JpegEncoder_Frame_SetColorContexts(IWICBitmapFrameEncode *
}
static HRESULT WINAPI JpegEncoder_Frame_SetPalette(IWICBitmapFrameEncode *iface,
- IWICPalette *pIPalette)
+ IWICPalette *palette)
{
- FIXME("(%p,%p): stub\n", iface, pIPalette);
- return WINCODEC_ERR_UNSUPPORTEDOPERATION;
+ JpegEncoder *This = impl_from_IWICBitmapFrameEncode(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 JpegEncoder_Frame_SetThumbnail(IWICBitmapFrameEncode *iface,
@@ -1516,6 +1532,7 @@ HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv)
This->xres = This->yres = 0.0;
This->format = NULL;
This->stream = NULL;
+ This->colors = 0;
InitializeCriticalSection(&This->lock);
This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JpegEncoder.lock");
--
2.9.0

View File

@ -0,0 +1,44 @@
From 7e6eb1a23949bddd3538447d5393d4b66d061f1b Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 16 Oct 2016 17:34:21 +0800
Subject: windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in JPEG
encoder.
---
dlls/windowscodecs/jpegformat.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index 9ec64e7..7d8beab 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -1386,11 +1386,22 @@ static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
return E_NOTIMPL;
}
-static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
- IWICBitmapEncoderInfo **ppIEncoderInfo)
+static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info)
{
- FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo);
- return E_NOTIMPL;
+ 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;
}
static HRESULT WINAPI JpegEncoder_SetColorContexts(IWICBitmapEncoder *iface,
--
2.9.0

View File

@ -0,0 +1,36 @@
From 6a2b1a19e6f4b6eec02097d3ba55958ec58a7146 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 16 Oct 2016 17:36:32 +0800
Subject: windowscodecs: Avoid crashing if no IPropertyBag2 was passed to
IWICBitmapEncoder::CreateNewFrame in JPEG encoder.
---
dlls/windowscodecs/jpegformat.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index 7d8beab..45bb88f 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -1451,11 +1451,14 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
return WINCODEC_ERR_NOTINITIALIZED;
}
- hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions);
- if (FAILED(hr))
+ if (ppIEncoderOptions)
{
- LeaveCriticalSection(&This->lock);
- return hr;
+ hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions);
+ if (FAILED(hr))
+ {
+ LeaveCriticalSection(&This->lock);
+ return hr;
+ }
}
This->frame_count = 1;
--
2.9.0

View File

@ -0,0 +1,44 @@
From ac87acc7cb36198ed28d092b0278ea17ff6006b7 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 16 Oct 2016 17:38:39 +0800
Subject: windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in TIFF
encoder.
---
dlls/windowscodecs/tiffformat.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 1dacd87..4946e4d 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1873,11 +1873,22 @@ static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
return S_OK;
}
-static HRESULT WINAPI TiffEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
- IWICBitmapEncoderInfo **ppIEncoderInfo)
+static HRESULT WINAPI TiffEncoder_GetEncoderInfo(IWICBitmapEncoder *iface, IWICBitmapEncoderInfo **info)
{
- FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo);
- return E_NOTIMPL;
+ 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;
}
static HRESULT WINAPI TiffEncoder_SetColorContexts(IWICBitmapEncoder *iface,
--
2.9.0

View File

@ -0,0 +1,35 @@
From c89c3a6950bb3514bef044df6488000861a261e4 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 16 Oct 2016 17:40:14 +0800
Subject: windowscodecs: Avoid crashing if no IPropertyBag2 was passed to
IWICBitmapEncoder::CreateNewFrame in TIFF encoder.
---
dlls/windowscodecs/tiffformat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 4946e4d..5071147 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1938,7 +1938,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
hr = E_FAIL;
}
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(hr) && ppIEncoderOptions)
{
PROPBAG2 opts[2]= {{0}};
opts[0].pstrName = (LPOLESTR)wszTiffCompressionMethod;
@@ -1997,7 +1997,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
else
hr = E_OUTOFMEMORY;
- if (FAILED(hr))
+ if (FAILED(hr) && ppIEncoderOptions)
{
IPropertyBag2_Release(*ppIEncoderOptions);
*ppIEncoderOptions = NULL;
--
2.9.0

View File

@ -0,0 +1 @@
Fixes: Add initial implementation of GIF encoder to windowscodecs