Rebase against e9231beb865da13941d19eca016a6ccac07cb3f4.

This commit is contained in:
Zebediah Figura
2018-12-04 20:17:06 -06:00
parent 6fb7d85916
commit 08623c69c9
15 changed files with 105 additions and 1244 deletions

View File

@@ -1,26 +0,0 @@
From 277591557f9b5a0d175460f95bb0be9c7ed93f09 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 20 Sep 2016 17:17:42 +0800
Subject: windowscodecs: Use V_UI1() instead of V_UNION() to assign
a VT_UI1 variant member.
---
dlls/windowscodecs/tiffformat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 6fe3f19677..2238a0eaa8 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1973,7 +1973,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
VARIANT v;
VariantInit(&v);
V_VT(&v) = VT_UI1;
- V_UNION(&v, bVal) = WICTiffCompressionDontCare;
+ V_UI1(&v) = WICTiffCompressionDontCare;
hr = IPropertyBag2_Write(*ppIEncoderOptions, 1, (PROPBAG2 *)opts, &v);
VariantClear(&v);
if (FAILED(hr))
--
2.16.2

View File

@@ -1,25 +0,0 @@
From 818ad232038c7b56183f0d20ad4fa93624e09f17 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 23 Sep 2016 20:17:47 +0800
Subject: windowscodecs: Limit number of colors in a palette in BMP decoder.
---
dlls/windowscodecs/bmpdecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c
index 2bcb81e0d6..47f312ffcf 100644
--- a/dlls/windowscodecs/bmpdecode.c
+++ b/dlls/windowscodecs/bmpdecode.c
@@ -271,7 +271,7 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
if (This->bih.bV5ClrUsed == 0)
count = 1 << This->bih.bV5BitCount;
else
- count = This->bih.bV5ClrUsed;
+ count = min(This->bih.bV5ClrUsed, 1 << This->bih.bV5BitCount);
tablesize = sizeof(WICColor) * count;
wiccolors = HeapAlloc(GetProcessHeap(), 0, tablesize);
--
2.16.2

View File

@@ -1,122 +0,0 @@
From 0b8859b133017e8f192e5ffb425837ea87c31ddb Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 4 Oct 2016 18:33:40 +0800
Subject: [PATCH] windowscodecs: find_decoder() should return an error it
received from the decoder.
If IWICBitmapDecoderInfo::MatchesPattern() has recognized the decoder by the pattern,
and the called IWICBitmapDecoder::Initialize() has failed, an error should be returned
right away instead of trying next codec. This allows report image format related errors
instead of WINCODEC_ERR_COMPONENTNOTFOUND.
---
dlls/windowscodecs/imgfactory.c | 42 ++++++++++++++++++---------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c
index dbcc5f59234..58ef1a02f68 100644
--- a/dlls/windowscodecs/imgfactory.c
+++ b/dlls/windowscodecs/imgfactory.c
@@ -130,22 +130,23 @@ static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename(
return hr;
}
-static IWICBitmapDecoder *find_decoder(IStream *pIStream, const GUID *pguidVendor,
- WICDecodeOptions metadataOptions)
+static HRESULT find_decoder(IStream *pIStream, const GUID *pguidVendor,
+ WICDecodeOptions metadataOptions, IWICBitmapDecoder **decoder)
{
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 NULL;
+ if (FAILED(res)) return res;
- while (!decoder)
+ while (!*decoder)
{
res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
@@ -170,18 +171,21 @@ static IWICBitmapDecoder *find_decoder(IStream *pIStream, const GUID *pguidVendo
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);
- decoder = NULL;
+ IWICBitmapDecoder_Release(*decoder);
+ IWICBitmapDecoderInfo_Release(decoderinfo);
+ IUnknown_Release(unkdecoderinfo);
+ *decoder = NULL;
+ return res;
}
}
}
@@ -197,7 +201,7 @@ static IWICBitmapDecoder *find_decoder(IStream *pIStream, const GUID *pguidVendo
IEnumUnknown_Release(enumdecoders);
- return decoder;
+ return WINCODEC_ERR_COMPONENTNOTFOUND;
}
static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream(
@@ -211,9 +215,9 @@ static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream(
metadataOptions, ppIDecoder);
if (pguidVendor)
- decoder = find_decoder(pIStream, pguidVendor, metadataOptions);
+ res = find_decoder(pIStream, pguidVendor, metadataOptions, &decoder);
if (!decoder)
- decoder = find_decoder(pIStream, NULL, metadataOptions);
+ res = find_decoder(pIStream, NULL, metadataOptions, &decoder);
if (decoder)
{
@@ -228,17 +232,17 @@ static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream(
BYTE data[4];
ULONG bytesread;
- WARN("failed to load from a stream\n");
+ WARN("failed to load from a stream %#x\n", res);
seek.QuadPart = 0;
- 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]);
+ 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]);
+ }
}
*ppIDecoder = NULL;
- return WINCODEC_ERR_COMPONENTNOTFOUND;
+ return res;
}
}
--
2.19.0

View File

@@ -1,63 +0,0 @@
From 828277c6706d2362f49c2a85b5f98ee224c0f059 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 4 Oct 2016 18:39:40 +0800
Subject: windowscodecs: PNG decoder should return
WINCODEC_ERR_UNKNOWNIMAGEFORMAT when image loading fails.
---
dlls/windowscodecs/pngformat.c | 2 +-
dlls/windowscodecs/tests/pngformat.c | 4 ----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index 26b5fd52bc..e5ad7876aa 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -622,7 +622,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 = E_FAIL;
+ hr = WINCODEC_ERR_UNKNOWNIMAGEFORMAT;
goto end;
}
ppng_set_error_fn(This->png_ptr, jmpbuf, user_error_fn, user_warning_fn);
diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c
index 4b84ccebb1..3a0ea28ead 100644
--- a/dlls/windowscodecs/tests/pngformat.c
+++ b/dlls/windowscodecs/tests/pngformat.c
@@ -726,7 +726,6 @@ static void test_color_formats(void)
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, TRUE))
-todo_wine
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
else
todo_wine_if(td[i].todo_load)
@@ -755,7 +754,6 @@ next_1:
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, TRUE))
-todo_wine
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
else
todo_wine_if(td[i].todo_load)
@@ -784,7 +782,6 @@ next_2:
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, FALSE))
-todo_wine
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
else
todo_wine_if(td[i].todo_load)
@@ -812,7 +809,6 @@ next_3:
hr = create_decoder(buf, sizeof(buf), &decoder);
if (!is_valid_png_type_depth(td[i].color_type, td[i].bit_depth, FALSE))
-todo_wine
ok(hr == WINCODEC_ERR_UNKNOWNIMAGEFORMAT, "%d: wrong error %#x\n", i, hr);
else
todo_wine_if(td[i].todo_load)
--
2.16.2