diff --git a/patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch b/patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch index 9acdd9b3..1e74eada 100644 --- a/patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch +++ b/patches/d3dx9_36-FindNextValidTechnique/0001-d3dx9_36-Implement-ID3DXEffect_FindNextValidTechniqu.patch @@ -1,4 +1,4 @@ -From 4615fc9e392d8942286b4cb40482a6ede5ad6d59 Mon Sep 17 00:00:00 2001 +From 73498c6ee55422b032f7a0e3c2329254a810e5d3 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Fri, 19 Dec 2014 22:31:46 +0100 Subject: d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add tests. @@ -9,11 +9,11 @@ Subject: d3dx9_36: Implement ID3DXEffect_FindNextValidTechnique + add tests. 2 files changed, 91 insertions(+), 3 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c -index 2cd0c22f646..6c30eb78640 100644 +index ce2e5d86e5f..0f2f9cfd2d7 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c -@@ -3948,13 +3948,41 @@ static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DX - return D3D_OK; +@@ -3984,13 +3984,41 @@ done: + return ret; } -static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique) @@ -58,10 +58,10 @@ index 2cd0c22f646..6c30eb78640 100644 static BOOL walk_parameter_dep(struct d3dx_parameter *param, walk_parameter_dep_func param_func, diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c -index bb26fe4e515..a7ce30dd65e 100644 +index 96b21f0454c..6b81582ab7e 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c -@@ -7162,6 +7162,65 @@ static void test_effect_unsupported_shader(void) +@@ -7281,6 +7281,65 @@ static void test_effect_null_shader(void) DestroyWindow(window); } @@ -127,14 +127,14 @@ index bb26fe4e515..a7ce30dd65e 100644 START_TEST(effect) { HWND wnd; -@@ -7215,6 +7274,7 @@ START_TEST(effect) +@@ -7333,6 +7392,7 @@ START_TEST(effect) + test_effect_large_address_aware_flag(device); test_effect_get_pass_desc(device); test_effect_skip_constants(device); - test_effect_unsupported_shader(); + test_effect_technique_validation(device); - count = IDirect3DDevice9_Release(device); - ok(count == 0, "The device was not properly freed: refcount %u\n", count); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); -- 2.14.1 diff --git a/patches/ntdll-NtQuerySection/0002-kernel32-tests-Add-tests-for-NtQuerySection.patch b/patches/ntdll-NtQuerySection/0002-kernel32-tests-Add-tests-for-NtQuerySection.patch index 554cba32..fb4ad591 100644 --- a/patches/ntdll-NtQuerySection/0002-kernel32-tests-Add-tests-for-NtQuerySection.patch +++ b/patches/ntdll-NtQuerySection/0002-kernel32-tests-Add-tests-for-NtQuerySection.patch @@ -1,14 +1,14 @@ -From 9b893a6f231547a99090342749bc60ae58d02272 Mon Sep 17 00:00:00 2001 +From f4e45bfd295d4d8d8312502d367c648575a36f46 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Thu, 16 Oct 2014 23:26:35 +0200 Subject: kernel32/tests: Add tests for NtQuerySection. (try 2) --- - dlls/kernel32/tests/virtual.c | 248 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 248 insertions(+) + dlls/kernel32/tests/virtual.c | 245 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 245 insertions(+) diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c -index 583abf6..3d60557 100644 +index 9b994645bc5..5191d6ce9b0 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -56,6 +56,23 @@ static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG) @@ -35,7 +35,7 @@ index 583abf6..3d60557 100644 static HANDLE create_target_process(const char *arg) { char **argv; -@@ -3845,6 +3862,236 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access) +@@ -4143,6 +4160,233 @@ static void test_shared_memory_ro(BOOL is_child, DWORD child_access) CloseHandle(mapping); } @@ -207,9 +207,7 @@ index 583abf6..3d60557 100644 + + SetLastError(0xdeadbef); + mapping = CreateFileMappingA(file, NULL, PAGE_READONLY|SEC_RESERVE, 0, 0, NULL); -+todo_wine + ok(mapping != 0, "CreateFileMapping error %u\n", GetLastError()); -+ if (!mapping) goto skip1; + + memset(&info, 0x55, sizeof(info)); + ret = 0xdeadbeef; @@ -221,7 +219,6 @@ index 583abf6..3d60557 100644 + ok(info.basic.Size.QuadPart == fsize, "expected %#lx, got %#x/%08x\n", fsize, info.basic.Size.HighPart, info.basic.Size.LowPart); + + CloseHandle(mapping); -+skip1: + CloseHandle(file); + + SetLastError(0xdeadbef); @@ -272,7 +269,7 @@ index 583abf6..3d60557 100644 START_TEST(virtual) { int argc; -@@ -3908,6 +4155,7 @@ START_TEST(virtual) +@@ -4206,6 +4450,7 @@ START_TEST(virtual) test_shared_memory_ro(FALSE, FILE_MAP_COPY); test_shared_memory_ro(FALSE, FILE_MAP_COPY|FILE_MAP_WRITE); test_mapping(); @@ -281,5 +278,5 @@ index 583abf6..3d60557 100644 test_VirtualAlloc_protection(); test_VirtualProtect(); -- -2.8.0 +2.14.1 diff --git a/patches/ntdll-NtQuerySection/0003-server-CreateFileMapping-should-not-fail-without-SEC.patch b/patches/ntdll-NtQuerySection/0003-server-CreateFileMapping-should-not-fail-without-SEC.patch deleted file mode 100644 index 76356a7a..00000000 --- a/patches/ntdll-NtQuerySection/0003-server-CreateFileMapping-should-not-fail-without-SEC.patch +++ /dev/null @@ -1,53 +0,0 @@ -From a02d5eb0b87c5358e2431cd3c96e76f20bb51e88 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Wed, 9 Mar 2016 13:06:13 +0800 -Subject: server: CreateFileMapping should not fail without SEC_COMMIT for a - named file section. - -Anonymous file mapping already behaves this way. ---- - dlls/kernel32/tests/virtual.c | 3 --- - server/mapping.c | 5 +++-- - 2 files changed, 3 insertions(+), 5 deletions(-) - -diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c -index 3d60557..c6e7ebe 100644 ---- a/dlls/kernel32/tests/virtual.c -+++ b/dlls/kernel32/tests/virtual.c -@@ -4030,9 +4030,7 @@ todo_wine - - SetLastError(0xdeadbef); - mapping = CreateFileMappingA(file, NULL, PAGE_READONLY|SEC_RESERVE, 0, 0, NULL); --todo_wine - ok(mapping != 0, "CreateFileMapping error %u\n", GetLastError()); -- if (!mapping) goto skip1; - - memset(&info, 0x55, sizeof(info)); - ret = 0xdeadbeef; -@@ -4044,7 +4042,6 @@ todo_wine - ok(info.basic.Size.QuadPart == fsize, "expected %#lx, got %#x/%08x\n", fsize, info.basic.Size.HighPart, info.basic.Size.LowPart); - - CloseHandle(mapping); --skip1: - CloseHandle(file); - - SetLastError(0xdeadbef); -diff --git a/server/mapping.c b/server/mapping.c -index b68f281..1f18c5c 100644 ---- a/server/mapping.c -+++ b/server/mapping.c -@@ -533,8 +533,9 @@ static struct object *create_mapping( struct object *root, const struct unicode_ - - if (flags & SEC_RESERVE) - { -- set_error( STATUS_INVALID_PARAMETER ); -- goto error; -+ if (!(mapping->committed = mem_alloc( offsetof(struct ranges, ranges[8]) ))) goto error; -+ mapping->committed->count = 0; -+ mapping->committed->max = 8; - } - if (!(file = get_file_obj( current->process, handle, access ))) goto error; - fd = get_obj_fd( (struct object *)file ); --- -2.8.0 - diff --git a/patches/ntdll-NtQueryVirtualMemory/0010-ntdll-Skip-get_dll_info-wineserver-call-if-address-d.patch b/patches/ntdll-NtQueryVirtualMemory/0010-ntdll-Skip-get_dll_info-wineserver-call-if-address-d.patch index 7e9316f0..428f205f 100644 --- a/patches/ntdll-NtQueryVirtualMemory/0010-ntdll-Skip-get_dll_info-wineserver-call-if-address-d.patch +++ b/patches/ntdll-NtQueryVirtualMemory/0010-ntdll-Skip-get_dll_info-wineserver-call-if-address-d.patch @@ -2,7 +2,7 @@ From 9b91067e59331f33825d0a5bc3e1f86f67714830 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 28 May 2017 16:14:03 +0200 Subject: ntdll: Skip get_dll_info wineserver call if address does not have - VPROT_IMAGE permissions. + SEC_IMAGE permissions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -30,7 +30,7 @@ index a5c3ce69185..0d5150aaf93 100644 + status = NtDuplicateObject( NtCurrentProcess(), view->mapping, NtCurrentProcess(), + mapping, 0, 0, DUP_HANDLE_SAME_ACCESS ); + } -+ else if (view->protect & VPROT_IMAGE) ++ else if (view->protect & SEC_IMAGE) + { + *mapping = NULL; + status = STATUS_SUCCESS; diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index ef25d9d9..514b6dd5 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "c9f72ccec2387da0c02fa1d35997fb914dcf4656" + echo "917e86dd7a4cca1da47262caaded2bef9e022f99" } # Show version information @@ -6573,14 +6573,12 @@ fi # Patchset ntdll-NtQuerySection # | # | Modified files: -# | * dlls/kernel32/tests/virtual.c, server/mapping.c +# | * dlls/kernel32/tests/virtual.c # | if test "$enable_ntdll_NtQuerySection" -eq 1; then patch_apply ntdll-NtQuerySection/0002-kernel32-tests-Add-tests-for-NtQuerySection.patch - patch_apply ntdll-NtQuerySection/0003-server-CreateFileMapping-should-not-fail-without-SEC.patch ( printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Add tests for NtQuerySection.", 2 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "server: CreateFileMapping should not fail without SEC_COMMIT for a named file section.", 1 },'; ) >> "$patchlist" fi @@ -6618,7 +6616,7 @@ if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: Implement K32GetMappedFileName.", 2 },'; printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Resolve drive symlinks before returning section name.", 1 },'; printf '%s\n' '+ { "Michael Müller", "ntdll: Fix error code when querying too large memory address.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Skip get_dll_info wineserver call if address does not have VPROT_IMAGE permissions.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Skip get_dll_info wineserver call if address does not have SEC_IMAGE permissions.", 1 },'; ) >> "$patchlist" fi @@ -9116,7 +9114,6 @@ fi # | dlls/windowscodecs/tests/converter.c, dlls/windowscodecs/tests/pngformat.c, dlls/windowscodecs/tiffformat.c # | if test "$enable_windowscodecs_Palette_Images" -eq 1; then - patch_apply windowscodecs-Palette_Images/0004-windowscodecs-Decode-PNG-images-with-a-tRNS-chunk-in.patch patch_apply windowscodecs-Palette_Images/0005-windowscodecs-Add-support-for-palette-image-formats-.patch patch_apply windowscodecs-Palette_Images/0006-windowscodecs-Fix-IWICBitmapEncoder-SetPalette-for-a.patch patch_apply windowscodecs-Palette_Images/0007-windowscodecs-Implement-IWICBitmapFrameEncode-SetPal.patch @@ -9130,13 +9127,9 @@ if test "$enable_windowscodecs_Palette_Images" -eq 1; then patch_apply windowscodecs-Palette_Images/0015-windowscodecs-Write-the-image-bits-as-a-bottom-top-a.patch patch_apply windowscodecs-Palette_Images/0016-windowscodecs-Limit-number-of-colors-in-a-palette-in.patch patch_apply windowscodecs-Palette_Images/0017-windowscodecs-Add-support-for-palette-image-formats-.patch - patch_apply windowscodecs-Palette_Images/0018-windowscodecs-tests-Make-create_decoder-return-an-er.patch - patch_apply windowscodecs-Palette_Images/0019-windowscodecs-tests-Add-more-tests-for-loading-PNG-i.patch patch_apply windowscodecs-Palette_Images/0020-windowscodecs-find_decoder-should-return-an-error-it.patch patch_apply windowscodecs-Palette_Images/0021-windowscodecs-PNG-decoder-should-return-WINCODEC_ERR.patch - patch_apply windowscodecs-Palette_Images/0022-windowscodecs-PNG-decoder-should-use-indexed-formats.patch ( - printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Decode PNG images with a tRNS chunk in their native formats.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for palette image formats to PNG encoder.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Fix IWICBitmapEncoder::SetPalette for a not initialized case in BMP encoder.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapFrameEncode::SetPalette in BMP encoder.", 1 },'; @@ -9150,11 +9143,8 @@ if test "$enable_windowscodecs_Palette_Images" -eq 1; then printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Write the image bits as a bottom-top array in BMP encoder.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Limit number of colors in a palette in BMP decoder.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for palette image formats to BMP encoder.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Make create_decoder() return an error code in PNG tests.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add more tests for loading PNG images in various color formats.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Find_decoder() should return an error it received from the decoder.", 1 },'; printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: PNG decoder should return WINCODEC_ERR_UNKNOWNIMAGEFORMAT when image loading fails.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: PNG decoder should use indexed formats for grayscale images when a PLTE chunk exists.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch b/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch index 110bdc2e..34263644 100644 --- a/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch +++ b/patches/server-Shared_Memory/0001-ntdll-Implement-virtual_map_shared_memory.patch @@ -56,7 +56,7 @@ index 9f1b6da0c5e..4f816b2b1ca 100644 + /* Map the shared memory */ + + prot = VIRTUAL_GetUnixProt( vprot ); -+ if (force_exec_prot && !(vprot & VPROT_NOEXEC) && (vprot & VPROT_READ)) ++ if (force_exec_prot && (vprot & VPROT_READ)) + { + TRACE( "forcing exec permission on mapping %p-%p\n", + (char *)view->base, (char *)view->base + size - 1 ); diff --git a/patches/windowscodecs-Palette_Images/0004-windowscodecs-Decode-PNG-images-with-a-tRNS-chunk-in.patch b/patches/windowscodecs-Palette_Images/0004-windowscodecs-Decode-PNG-images-with-a-tRNS-chunk-in.patch deleted file mode 100644 index 6656082d..00000000 --- a/patches/windowscodecs-Palette_Images/0004-windowscodecs-Decode-PNG-images-with-a-tRNS-chunk-in.patch +++ /dev/null @@ -1,82 +0,0 @@ -From c599c18b043d130c67aa0ccab02de57d0ea9fd9d Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Tue, 20 Sep 2016 14:22:44 +0800 -Subject: windowscodecs: Decode PNG images with a tRNS chunk in their native - formats. - -... instead of auto-converting them to PNG_COLOR_TYPE_RGB_ALPHA. ---- - dlls/windowscodecs/pngformat.c | 36 +++++++----------------------------- - 1 file changed, 7 insertions(+), 29 deletions(-) - -diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c -index 410b34f..c131fed 100644 ---- a/dlls/windowscodecs/pngformat.c -+++ b/dlls/windowscodecs/pngformat.c -@@ -319,11 +319,6 @@ MAKE_FUNCPTR(png_get_tRNS); - MAKE_FUNCPTR(png_set_bgr); - MAKE_FUNCPTR(png_set_crc_action); - MAKE_FUNCPTR(png_set_error_fn); --#ifdef HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8 --MAKE_FUNCPTR(png_set_expand_gray_1_2_4_to_8); --#else --MAKE_FUNCPTR(png_set_gray_1_2_4_to_8); --#endif - MAKE_FUNCPTR(png_set_filler); - MAKE_FUNCPTR(png_set_filter); - MAKE_FUNCPTR(png_set_gray_to_rgb); -@@ -388,11 +383,6 @@ static void *load_libpng(void) - LOAD_FUNCPTR(png_set_bgr); - LOAD_FUNCPTR(png_set_crc_action); - LOAD_FUNCPTR(png_set_error_fn); --#ifdef HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8 -- LOAD_FUNCPTR(png_set_expand_gray_1_2_4_to_8); --#else -- LOAD_FUNCPTR(png_set_gray_1_2_4_to_8); --#endif - LOAD_FUNCPTR(png_set_filler); - LOAD_FUNCPTR(png_set_filter); - LOAD_FUNCPTR(png_set_gray_to_rgb); -@@ -585,6 +575,8 @@ 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; -@@ -651,25 +643,11 @@ 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 (transparency && color_type != PNG_COLOR_TYPE_PALETTE) -- { -- /* expand to RGBA */ -- if (color_type == PNG_COLOR_TYPE_GRAY) -- { -- if (bit_depth < 8) -- { --#ifdef HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8 -- ppng_set_expand_gray_1_2_4_to_8(This->png_ptr); --#else -- ppng_set_gray_1_2_4_to_8(This->png_ptr); --#endif -- bit_depth = 8; -- } -- ppng_set_gray_to_rgb(This->png_ptr); -- } -- ppng_set_tRNS_to_alpha(This->png_ptr); -- color_type = PNG_COLOR_TYPE_RGB_ALPHA; -- } -+ 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); - - switch (color_type) - { --- -2.9.0 - diff --git a/patches/windowscodecs-Palette_Images/0018-windowscodecs-tests-Make-create_decoder-return-an-er.patch b/patches/windowscodecs-Palette_Images/0018-windowscodecs-tests-Make-create_decoder-return-an-er.patch deleted file mode 100644 index 421c5259..00000000 --- a/patches/windowscodecs-Palette_Images/0018-windowscodecs-tests-Make-create_decoder-return-an-er.patch +++ /dev/null @@ -1,127 +0,0 @@ -From df6bff3ca093f772ae40bc98ae32fcd3c19aa963 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Tue, 4 Oct 2016 18:20:31 +0800 -Subject: windowscodecs/tests: Make create_decoder() return an error code in - PNG tests. - ---- - dlls/windowscodecs/tests/pngformat.c | 63 ++++++++++++++++++------------------ - 1 file changed, 32 insertions(+), 31 deletions(-) - -diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c -index 58f698d987..5d11c65f1d 100644 ---- a/dlls/windowscodecs/tests/pngformat.c -+++ b/dlls/windowscodecs/tests/pngformat.c -@@ -276,37 +276,38 @@ static const char png_color_profile[] = { - - static IWICImagingFactory *factory; - --static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size) -+static HRESULT create_decoder(const void *image_data, UINT image_size, IWICBitmapDecoder **decoder) - { - HRESULT hr; -- IWICBitmapDecoder *decoder = NULL; - IStream *stream; - GUID format; - LONG refcount; - ULARGE_INTEGER pos; - LARGE_INTEGER zero; - -+ *decoder = NULL; -+ - stream = SHCreateMemStream (image_data, image_size); - ok(stream != NULL, "SHCreateMemStream error\n"); - -- hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder); -- ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr); -- if (FAILED(hr)) return NULL; -- -- hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format); -- ok(hr == S_OK, "GetContainerFormat error %#x\n", hr); -- ok(IsEqualGUID(&format, &GUID_ContainerFormatPng), -- "wrong container format %s\n", wine_dbgstr_guid(&format)); -- -- zero.QuadPart = 0; -- IStream_Seek (stream, zero, STREAM_SEEK_CUR, &pos); -- ok(pos.QuadPart < image_size, "seek beyond the end of stream: %x%08x >= %x\n", -- (UINT)(pos.QuadPart >> 32), (UINT)pos.QuadPart, image_size); -- -- refcount = IStream_Release(stream); -- ok(refcount > 0, "expected stream refcount > 0\n"); -+ hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, decoder); -+ if (hr == S_OK) -+ { -+ hr = IWICBitmapDecoder_GetContainerFormat(*decoder, &format); -+ ok(hr == S_OK, "GetContainerFormat error %#x\n", hr); -+ ok(IsEqualGUID(&format, &GUID_ContainerFormatPng), -+ "wrong container format %s\n", wine_dbgstr_guid(&format)); -+ -+ zero.QuadPart = 0; -+ IStream_Seek (stream, zero, STREAM_SEEK_CUR, &pos); -+ ok(pos.QuadPart < image_size, "seek beyond the end of stream: %x%08x >= %x\n", -+ (UINT)(pos.QuadPart >> 32), (UINT)pos.QuadPart, image_size); -+ -+ refcount = IStream_Release(stream); -+ ok(refcount > 0, "expected stream refcount > 0\n"); -+ } - -- return decoder; -+ return hr; - } - - static WCHAR *save_profile( BYTE *buffer, UINT size ) -@@ -342,9 +343,9 @@ static void test_color_contexts(void) - BYTE *buffer; - BOOL ret; - -- decoder = create_decoder(png_no_color_profile, sizeof(png_no_color_profile)); -- ok(decoder != 0, "Failed to load PNG image data\n"); -- if (!decoder) return; -+ hr = create_decoder(png_no_color_profile, sizeof(png_no_color_profile), &decoder); -+ ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr); -+ if (hr != S_OK) return; - - /* global color context */ - hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, NULL); -@@ -370,9 +371,9 @@ static void test_color_contexts(void) - IWICBitmapFrameDecode_Release(frame); - IWICBitmapDecoder_Release(decoder); - -- decoder = create_decoder(png_color_profile, sizeof(png_color_profile)); -- ok(decoder != 0, "Failed to load PNG image data\n"); -- if (!decoder) return; -+ hr = create_decoder(png_color_profile, sizeof(png_color_profile), &decoder); -+ ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr); -+ if (hr != S_OK) return; - - /* global color context */ - count = 0xdeadbeef; -@@ -548,9 +549,9 @@ static void test_png_palette(void) - UINT count, ret; - WICColor color[256]; - -- decoder = create_decoder(png_PLTE_tRNS, sizeof(png_PLTE_tRNS)); -- ok(decoder != 0, "Failed to load PNG image data\n"); -- if (!decoder) return; -+ hr = create_decoder(png_PLTE_tRNS, sizeof(png_PLTE_tRNS), &decoder); -+ ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr); -+ if (hr != S_OK) return; - - hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); - ok(hr == S_OK, "GetFrame error %#x\n", hr); -@@ -618,9 +619,9 @@ static void test_color_formats(void) - buf[24] = td[i].bit_depth; - buf[25] = td[i].color_type; - -- decoder = create_decoder(buf, sizeof(buf)); -- ok(decoder != NULL, "Failed to load PNG image data\n"); -- if (!decoder) continue; -+ hr = create_decoder(buf, sizeof(buf), &decoder); -+ ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr); -+ if (hr != S_OK) return; - - hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); - ok(hr == S_OK, "GetFrame error %#x\n", hr); --- -2.11.0 - diff --git a/patches/windowscodecs-Palette_Images/0019-windowscodecs-tests-Add-more-tests-for-loading-PNG-i.patch b/patches/windowscodecs-Palette_Images/0019-windowscodecs-tests-Add-more-tests-for-loading-PNG-i.patch deleted file mode 100644 index c6ea91f6..00000000 --- a/patches/windowscodecs-Palette_Images/0019-windowscodecs-tests-Add-more-tests-for-loading-PNG-i.patch +++ /dev/null @@ -1,277 +0,0 @@ -From a11b0ed49b0de9622408c44d82196b1d18d36715 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Tue, 4 Oct 2016 18:26:22 +0800 -Subject: windowscodecs/tests: Add more tests for loading PNG images in various - color formats. - ---- - dlls/windowscodecs/tests/pngformat.c | 218 +++++++++++++++++++++++++++++++++-- - 1 file changed, 208 insertions(+), 10 deletions(-) - -diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c -index 95393c9..aee8e4e 100644 ---- a/dlls/windowscodecs/tests/pngformat.c -+++ b/dlls/windowscodecs/tests/pngformat.c -@@ -584,43 +584,211 @@ static void test_png_palette(void) - static const char png_1x1_data[] = { - 0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a, - 0x00,0x00,0x00,0x0d,'I','H','D','R',0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53,0xde, -+ 0x00,0x00,0x03,0x00,'P','L','T','E', -+ 0x01,0x01,0x01,0x02,0x02,0x02,0x03,0x03,0x03,0x04,0x04,0x04,0x05,0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08, -+ 0x09,0x09,0x09,0x0a,0x0a,0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d,0x0d,0x0d,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x10,0x10,0x10, -+ 0x11,0x11,0x11,0x12,0x12,0x12,0x13,0x13,0x13,0x14,0x14,0x14,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18, -+ 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20, -+ 0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x27,0x27,0x28,0x28,0x28, -+ 0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x30,0x30,0x30, -+ 0x31,0x31,0x31,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38, -+ 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40, -+ 0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48, -+ 0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50,0x50, -+ 0x51,0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x58,0x58,0x58, -+ 0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x60, -+ 0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x63,0x64,0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x68,0x68,0x68, -+ 0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f,0x70,0x70,0x70, -+ 0x71,0x71,0x71,0x72,0x72,0x72,0x73,0x73,0x73,0x74,0x74,0x74,0x75,0x75,0x75,0x76,0x76,0x76,0x77,0x77,0x77,0x78,0x78,0x78, -+ 0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x80, -+ 0x01,0x01,0x01,0x02,0x02,0x02,0x03,0x03,0x03,0x04,0x04,0x04,0x05,0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08, -+ 0x09,0x09,0x09,0x0a,0x0a,0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d,0x0d,0x0d,0x0e,0x0e,0x0e,0x0f,0x0f,0x0f,0x10,0x10,0x10, -+ 0x11,0x11,0x11,0x12,0x12,0x12,0x13,0x13,0x13,0x14,0x14,0x14,0x15,0x15,0x15,0x16,0x16,0x16,0x17,0x17,0x17,0x18,0x18,0x18, -+ 0x19,0x19,0x19,0x1a,0x1a,0x1a,0x1b,0x1b,0x1b,0x1c,0x1c,0x1c,0x1d,0x1d,0x1d,0x1e,0x1e,0x1e,0x1f,0x1f,0x1f,0x20,0x20,0x20, -+ 0x21,0x21,0x21,0x22,0x22,0x22,0x23,0x23,0x23,0x24,0x24,0x24,0x25,0x25,0x25,0x26,0x26,0x26,0x27,0x27,0x27,0x28,0x28,0x28, -+ 0x29,0x29,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x30,0x30,0x30, -+ 0x31,0x31,0x31,0x32,0x32,0x32,0x33,0x33,0x33,0x34,0x34,0x34,0x35,0x35,0x35,0x36,0x36,0x36,0x37,0x37,0x37,0x38,0x38,0x38, -+ 0x39,0x39,0x39,0x3a,0x3a,0x3a,0x3b,0x3b,0x3b,0x3c,0x3c,0x3c,0x3d,0x3d,0x3d,0x3e,0x3e,0x3e,0x3f,0x3f,0x3f,0x40,0x40,0x40, -+ 0x41,0x41,0x41,0x42,0x42,0x42,0x43,0x43,0x43,0x44,0x44,0x44,0x45,0x45,0x45,0x46,0x46,0x46,0x47,0x47,0x47,0x48,0x48,0x48, -+ 0x49,0x49,0x49,0x4a,0x4a,0x4a,0x4b,0x4b,0x4b,0x4c,0x4c,0x4c,0x4d,0x4d,0x4d,0x4e,0x4e,0x4e,0x4f,0x4f,0x4f,0x50,0x50,0x50, -+ 0x51,0x51,0x51,0x52,0x52,0x52,0x53,0x53,0x53,0x54,0x54,0x54,0x55,0x55,0x55,0x56,0x56,0x56,0x57,0x57,0x57,0x58,0x58,0x58, -+ 0x59,0x59,0x59,0x5a,0x5a,0x5a,0x5b,0x5b,0x5b,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,0x5e,0x5e,0x5e,0x5f,0x5f,0x5f,0x60,0x60,0x60, -+ 0x61,0x61,0x61,0x62,0x62,0x62,0x63,0x63,0x63,0x64,0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,0x67,0x67,0x67,0x68,0x68,0x68, -+ 0x69,0x69,0x69,0x6a,0x6a,0x6a,0x6b,0x6b,0x6b,0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x6f,0x70,0x70,0x70, -+ 0x71,0x71,0x71,0x72,0x72,0x72,0x73,0x73,0x73,0x74,0x74,0x74,0x75,0x75,0x75,0x76,0x76,0x76,0x77,0x77,0x77,0x78,0x78,0x78, -+ 0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7b,0x7c,0x7c,0x7c,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x80, -+ 0x76,0xb6,0x24,0x31, -+ 0x00,0x00,0x00,0x02,'t','R','N','S',0xff,0x00,0xe5,0xb7,0x30,0x4a, - 0x00,0x00,0x00,0x0c,'I','D','A','T',0x08,0xd7,0x63,0xf8,0xff,0xff,0x3f,0x00,0x05,0xfe,0x02,0xfe,0xdc,0xcc,0x59,0xe7, - 0x00,0x00,0x00,0x00,'I','E','N','D',0xae,0x42,0x60,0x82 - }; - -+static BOOL is_valid_png_type_depth(int color_type, int bit_depth, BOOL plte) -+{ -+ switch (color_type) -+ { -+ case 0: /* Grayscale */ -+ return bit_depth == 1 || bit_depth == 2 || bit_depth == 4 || bit_depth == 8 || bit_depth == 16; -+ -+ case 2: /* True Color */ -+ return bit_depth == 8 || bit_depth == 16; -+ -+ case 3: /* Indexed Color */ -+ return (bit_depth == 1 || bit_depth == 2 || bit_depth == 4 || bit_depth == 8) && plte; -+ -+ case 4: /* Grayscale with alpha */ -+ return bit_depth == 8 || bit_depth == 16; -+ -+ case 6: /* True Color with alpha */ -+ return bit_depth == 8 || bit_depth == 16; -+ -+ default: -+ ok(0, "unknown PNG type %d, depth %d\n", color_type, bit_depth); -+ return FALSE; -+ } -+} -+ - static void test_color_formats(void) - { - static const struct - { - char bit_depth, color_type; - const GUID *format; -+ const GUID *format_PLTE; -+ const GUID *format_PLTE_tRNS; -+ BOOL todo; -+ BOOL todo_load; - } td[] = - { - /* 2 - PNG_COLOR_TYPE_RGB */ -- { 8, 2, &GUID_WICPixelFormat24bppBGR }, -+ { 1, 2, NULL, NULL, NULL }, -+ { 2, 2, NULL, NULL, NULL }, -+ { 4, 2, NULL, NULL, NULL }, -+ { 8, 2, &GUID_WICPixelFormat24bppBGR, &GUID_WICPixelFormat24bppBGR, &GUID_WICPixelFormat24bppBGR }, -+ /* libpng refuses to load our test image complaining about extra compressed data, -+ * but libpng is still able to load the image with other combination of type/depth -+ * making RGB 16 bpp case special for some reason. Therefore todo = TRUE. -+ */ -+ { 16, 2, &GUID_WICPixelFormat48bppRGB, &GUID_WICPixelFormat48bppRGB, &GUID_WICPixelFormat48bppRGB, TRUE, TRUE }, -+ { 24, 2, NULL, NULL, NULL }, -+ { 32, 2, NULL, NULL, NULL }, - /* 0 - PNG_COLOR_TYPE_GRAY */ -- { 1, 0, &GUID_WICPixelFormatBlackWhite }, -- { 2, 0, &GUID_WICPixelFormat2bppGray }, -- { 4, 0, &GUID_WICPixelFormat4bppGray }, -- { 8, 0, &GUID_WICPixelFormat8bppGray }, -- { 16, 0, &GUID_WICPixelFormat16bppGray }, -+ { 1, 0, &GUID_WICPixelFormatBlackWhite, &GUID_WICPixelFormatBlackWhite, &GUID_WICPixelFormat1bppIndexed, TRUE }, -+ { 2, 0, &GUID_WICPixelFormat2bppGray, &GUID_WICPixelFormat2bppGray, &GUID_WICPixelFormat2bppIndexed, TRUE }, -+ { 4, 0, &GUID_WICPixelFormat4bppGray, &GUID_WICPixelFormat4bppGray, &GUID_WICPixelFormat4bppIndexed, TRUE }, -+ { 8, 0, &GUID_WICPixelFormat8bppGray, &GUID_WICPixelFormat8bppGray, &GUID_WICPixelFormat8bppIndexed, TRUE }, -+ { 16, 0, &GUID_WICPixelFormat16bppGray, &GUID_WICPixelFormat16bppGray, &GUID_WICPixelFormat64bppRGBA, TRUE }, -+ { 24, 0, NULL, NULL, NULL }, -+ { 32, 0, NULL, NULL, NULL }, -+ /* 3 - PNG_COLOR_TYPE_PALETTE */ -+ { 1, 3, &GUID_WICPixelFormat1bppIndexed, &GUID_WICPixelFormat1bppIndexed, &GUID_WICPixelFormat1bppIndexed }, -+ { 2, 3, &GUID_WICPixelFormat2bppIndexed, &GUID_WICPixelFormat2bppIndexed, &GUID_WICPixelFormat2bppIndexed }, -+ { 4, 3, &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat4bppIndexed, &GUID_WICPixelFormat4bppIndexed }, -+ { 8, 3, &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormat8bppIndexed, &GUID_WICPixelFormat8bppIndexed }, -+ { 16, 3, NULL, NULL, NULL }, -+ { 24, 3, NULL, NULL, NULL }, -+ { 32, 3, NULL, NULL, NULL }, - }; - char buf[sizeof(png_1x1_data)]; - HRESULT hr; - IWICBitmapDecoder *decoder; - IWICBitmapFrameDecode *frame; - GUID format; -- int i; -+ int i, PLTE_off = 0, tRNS_off = 0; -+ -+ memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); -+ for (i = 0; i < sizeof(png_1x1_data) - 4; i++) -+ { -+ if (!memcmp(buf + i, "tRNS", 4)) -+ tRNS_off = i; -+ else if (!memcmp(buf + i, "PLTE", 4)) -+ PLTE_off = i; -+ } -+ -+ ok(PLTE_off && tRNS_off, "PLTE offset %d, tRNS offset %d\n", PLTE_off, tRNS_off); -+ if (!PLTE_off || !tRNS_off) return; -+ -+ /* In order to test the image data with and without PLTE and tRNS chunks -+ * it's been decided to simply sero out the chunk id for testing puposes, -+ * and under Windows such images get loaded just fine. But unfortunately -+ * libpng refuses to load such images complaining about unknown chunk type. -+ * A workaround for this libpng limitation is to mark the "disabled" chunks -+ * with tEXt id. -+ */ - - for (i = 0; i < sizeof(td)/sizeof(td[0]); i++) - { -+ /* with the tRNS and PLTE chunks */ -+ memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); -+ buf[24] = td[i].bit_depth; -+ buf[25] = td[i].color_type; -+ -+ 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) -+ ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr); -+ if (hr != S_OK) goto next_1; -+ -+ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); -+ ok(hr == S_OK, "GetFrame error %#x\n", hr); -+ -+ hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format); -+ ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); -+todo_wine_if(td[i].todo) -+ ok(IsEqualGUID(&format, td[i].format_PLTE_tRNS), -+ "PLTE+tRNS: expected %s, got %s (type %d, bpp %d)\n", -+ wine_dbgstr_guid(td[i].format_PLTE_tRNS), wine_dbgstr_guid(&format), td[i].color_type, td[i].bit_depth); -+ -+ IWICBitmapFrameDecode_Release(frame); -+ IWICBitmapDecoder_Release(decoder); -+ -+next_1: -+ /* without the tRNS chunk */ - memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); - buf[24] = td[i].bit_depth; - buf[25] = td[i].color_type; -+ memcpy(buf + tRNS_off, "tEXt", 4); - - hr = create_decoder(buf, sizeof(buf), &decoder); -- ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr); -- if (hr != S_OK) return; -+ 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) -+ ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr); -+ if (hr != S_OK) goto next_2; -+ -+ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); -+ ok(hr == S_OK, "GetFrame error %#x\n", hr); -+ -+ hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format); -+ ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); -+ ok(IsEqualGUID(&format, td[i].format_PLTE), -+ "PLTE: expected %s, got %s (type %d, bpp %d)\n", -+ wine_dbgstr_guid(td[i].format_PLTE), wine_dbgstr_guid(&format), td[i].color_type, td[i].bit_depth); -+ -+ IWICBitmapFrameDecode_Release(frame); -+ IWICBitmapDecoder_Release(decoder); -+ -+next_2: -+ /* without the tRNS and PLTE chunks */ -+ memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); -+ buf[24] = td[i].bit_depth; -+ buf[25] = td[i].color_type; -+ memcpy(buf + PLTE_off, "tEXt", 4); -+ memcpy(buf + tRNS_off, "tEXt", 4); -+ -+ 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) -+ ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr); -+ if (hr != S_OK) goto next_3; - - hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); - ok(hr == S_OK, "GetFrame error %#x\n", hr); -@@ -628,7 +796,37 @@ static void test_color_formats(void) - hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format); - ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); - ok(IsEqualGUID(&format, td[i].format), -- "expected %s, got %s\n", wine_dbgstr_guid(td[i].format), wine_dbgstr_guid(&format)); -+ "expected %s, got %s (type %d, bpp %d)\n", -+ wine_dbgstr_guid(td[i].format), wine_dbgstr_guid(&format), td[i].color_type, td[i].bit_depth); -+ -+ IWICBitmapFrameDecode_Release(frame); -+ IWICBitmapDecoder_Release(decoder); -+ -+next_3: -+ /* without the PLTE chunk */ -+ memcpy(buf, png_1x1_data, sizeof(png_1x1_data)); -+ buf[24] = td[i].bit_depth; -+ buf[25] = td[i].color_type; -+ memcpy(buf + PLTE_off, "tEXt", 4); -+ -+ 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) -+ ok(hr == S_OK, "%d: Failed to load PNG image data (type %d, bpp %d) %#x\n", i, td[i].color_type, td[i].bit_depth, hr); -+ if (hr != S_OK) continue; -+ -+ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); -+ ok(hr == S_OK, "GetFrame error %#x\n", hr); -+ -+ hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format); -+ ok(hr == S_OK, "GetPixelFormat error %#x\n", hr); -+todo_wine_if(td[i].todo) -+ ok(IsEqualGUID(&format, td[i].format_PLTE_tRNS), -+ "tRNS: expected %s, got %s (type %d, bpp %d)\n", -+ wine_dbgstr_guid(td[i].format_PLTE_tRNS), wine_dbgstr_guid(&format), td[i].color_type, td[i].bit_depth); - - IWICBitmapFrameDecode_Release(frame); - IWICBitmapDecoder_Release(decoder); --- -2.9.0 - diff --git a/patches/windowscodecs-Palette_Images/0022-windowscodecs-PNG-decoder-should-use-indexed-formats.patch b/patches/windowscodecs-Palette_Images/0022-windowscodecs-PNG-decoder-should-use-indexed-formats.patch deleted file mode 100644 index 213c4ed3..00000000 --- a/patches/windowscodecs-Palette_Images/0022-windowscodecs-PNG-decoder-should-use-indexed-formats.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 7ea6ea9c3538448255f6c14047cdbb88e9d73336 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Tue, 4 Oct 2016 19:04:34 +0800 -Subject: windowscodecs: PNG decoder should use indexed formats for grayscale - images when a PLTE chunk exists. - -todo_wine statements in the tests can't be removed because libpng refuses to -return a PLTE chunk for grayscale images even though the chunk does exist in -the data stream, and issues a warning: "ignoring PLTE chunk in grayscale PNG". ---- - dlls/windowscodecs/pngformat.c | 18 +++++++++++++----- - 1 file changed, 13 insertions(+), 5 deletions(-) - -diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c -index 9cce735..1a409ae 100644 ---- a/dlls/windowscodecs/pngformat.c -+++ b/dlls/windowscodecs/pngformat.c -@@ -657,14 +657,22 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p - This->bpp = bit_depth; - 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 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 = E_FAIL; -+ hr = WINCODEC_ERR_UNKNOWNIMAGEFORMAT; - goto end; - } - break; --- -2.9.0 -