Rebase against 5cc5b102c1b0a66aa63b66f43f2da9a1a9d15ab6

This commit is contained in:
Alistair Leslie-Hughes 2018-12-07 12:01:21 +11:00
parent c9b23fb803
commit 7a69c317fc
20 changed files with 66 additions and 1931 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "cda846b8cbc39c07ce360a6660a1c8b2e2aca24b"
echo "5cc5b102c1b0a66aa63b66f43f2da9a1a9d15ab6"
}
# Show version information
@ -326,7 +326,6 @@ patch_enable_all ()
enable_windowscodecs_IMILBitmapSource="$1"
enable_windowscodecs_IWICPalette_InitializeFromBitmap="$1"
enable_windowscodecs_JPEG_Decoder="$1"
enable_windowscodecs_Palette_Images="$1"
enable_windowscodecs_TIFF_Support="$1"
enable_wine_inf_Directory_ContextMenuHandlers="$1"
enable_wine_inf_Dummy_CA_Certificate="$1"
@ -1132,9 +1131,6 @@ patch_enable ()
windowscodecs-JPEG_Decoder)
enable_windowscodecs_JPEG_Decoder="$2"
;;
windowscodecs-Palette_Images)
enable_windowscodecs_Palette_Images="$2"
;;
windowscodecs-TIFF_Support)
enable_windowscodecs_TIFF_Support="$2"
;;
@ -1820,13 +1816,6 @@ if test "$enable_windowscodecs_TIFF_Support" -eq 1; then
enable_windowscodecs_IWICPalette_InitializeFromBitmap=1
fi
if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
if test "$enable_windowscodecs_Palette_Images" -gt 1; then
abort "Patchset windowscodecs-Palette_Images disabled, but windowscodecs-GIF_Encoder depends on that."
fi
enable_windowscodecs_Palette_Images=1
fi
if test "$enable_uxtheme_GTK_Theming" -eq 1; then
if test "$enable_ntdll_DllRedirects" -gt 1; then
abort "Patchset ntdll-DllRedirects disabled, but uxtheme-GTK_Theming depends on that."
@ -5802,16 +5791,14 @@ fi
# | * [#45963] - Add SetupDiInstallDeviceInterfaces/SetupDiRegisterCoDeviceInstallers stubs
# |
# | Modified files:
# | * dlls/setupapi/devinst.c, dlls/setupapi/setupapi.spec, dlls/setupapi/tests/devinst.c
# | * dlls/setupapi/devinst.c, dlls/setupapi/setupapi.spec
# |
if test "$enable_setupapi_SetupDiGetDeviceInterfaceDetail" -eq 1; then
patch_apply setupapi-SetupDiGetDeviceInterfaceDetail/0001-setupapi-Add-SetupDiInstallDeviceInterfaces.patch
patch_apply setupapi-SetupDiGetDeviceInterfaceDetail/0002-setupapi-Add-SetupDiRegisterCoDeviceInstallers-stub.patch
patch_apply setupapi-SetupDiGetDeviceInterfaceDetail/0003-setupapi-SetupDiGetDeviceInterfaceDetail-should-fill.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "setupapi: Add SetupDiInstallDeviceInterfaces.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "setupapi: Add SetupDiRegisterCoDeviceInstallers stub.", 1 },';
printf '%s\n' '+ { "Michael Müller", "setupapi: SetupDiGetDeviceInterfaceDetail should fill out DeviceInfoData even if the buffer for DeviceInterfaceData is too small.", 1 },';
) >> "$patchlist"
fi
@ -6553,40 +6540,15 @@ if test "$enable_virtdisk_OpenVirtualDisk" -eq 1; then
) >> "$patchlist"
fi
# Patchset windowscodecs-Palette_Images
# |
# | Modified files:
# | * dlls/windowscodecs/bmpencode.c, dlls/windowscodecs/info.c, dlls/windowscodecs/regsvr.c,
# | dlls/windowscodecs/tests/converter.c, dlls/windowscodecs/tiffformat.c
# |
if test "$enable_windowscodecs_Palette_Images" -eq 1; then
patch_apply windowscodecs-Palette_Images/0012-windowscodecs-tests-Add-tests-for-encoding-2bpp-4bpp.patch
patch_apply windowscodecs-Palette_Images/0014-windowscodecs-Add-support-for-palette-image-formats-.patch
patch_apply windowscodecs-Palette_Images/0017-windowscodecs-Add-support-for-palette-image-formats-.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add tests for encoding 2bpp/4bpp images with a palette.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for palette image formats to TIFF encoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for palette image formats to BMP encoder.", 1 },';
) >> "$patchlist"
fi
# Patchset windowscodecs-GIF_Encoder
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * windowscodecs-Palette_Images
# |
# | Modified files:
# | * dlls/gdiplus/tests/image.c, dlls/windowscodecs/bmpencode.c, dlls/windowscodecs/clsfactory.c,
# | dlls/windowscodecs/converter.c, dlls/windowscodecs/gifformat.c, dlls/windowscodecs/info.c,
# | dlls/windowscodecs/jpegformat.c, dlls/windowscodecs/pngformat.c, dlls/windowscodecs/regsvr.c,
# | * dlls/gdiplus/tests/image.c, dlls/windowscodecs/clsfactory.c, dlls/windowscodecs/converter.c,
# | dlls/windowscodecs/gifformat.c, dlls/windowscodecs/info.c, dlls/windowscodecs/pngformat.c, dlls/windowscodecs/regsvr.c,
# | dlls/windowscodecs/tests/converter.c, dlls/windowscodecs/tiffformat.c, dlls/windowscodecs/wincodecs_private.h,
# | dlls/windowscodecs/windowscodecs_wincodec.idl
# |
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/0004-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
patch_apply windowscodecs-GIF_Encoder/0006-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
patch_apply windowscodecs-GIF_Encoder/0007-windowscodecs-tests-Add-IWICBitmapEncoderInfo-test.patch
patch_apply windowscodecs-GIF_Encoder/0008-windowscodecs-Add-initial-implementation-of-the-GIF-.patch
patch_apply windowscodecs-GIF_Encoder/0010-windowscodecs-Initialize-empty-property-bag-in-GIF-e.patch
@ -6595,23 +6557,15 @@ if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
patch_apply windowscodecs-GIF_Encoder/0014-windowscodecs-Fix-the-buffer-size-check-in-the-TIFF-.patch
patch_apply windowscodecs-GIF_Encoder/0015-windowscodecs-Add-support-for-converting-to-8bppInde.patch
patch_apply windowscodecs-GIF_Encoder/0016-windowscodecs-WICConvertBitmapSource-should-ask-IWIC.patch
patch_apply windowscodecs-GIF_Encoder/0017-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
patch_apply windowscodecs-GIF_Encoder/0018-windowscodecs-Implement-IWICBitmapEncoder-GetEncoder.patch
patch_apply windowscodecs-GIF_Encoder/0019-windowscodecs-Improve-stub-for-IWICBitmapDecoder-Get.patch
patch_apply windowscodecs-GIF_Encoder/0020-windowscodecs-Add-registration-of-the-GIF-encoder.patch
patch_apply windowscodecs-GIF_Encoder/0021-windowscodecs-Fix-IWICBitmapDecoder-CopyPalette-for-.patch
patch_apply windowscodecs-GIF_Encoder/0022-windowscodecs-Better-follow-the-GIF-spec-and-don-t-s.patch
patch_apply windowscodecs-GIF_Encoder/0023-windowscodecs-Fix-behaviour-of-format-converter-for-.patch
patch_apply windowscodecs-GIF_Encoder/0024-windowscodecs-tests-Add-a-bunch-of-new-tests-for-ind.patch
patch_apply windowscodecs-GIF_Encoder/0025-windowscodecs-tests-Add-some-tests-for-converting-24.patch
patch_apply windowscodecs-GIF_Encoder/0026-windowscodecs-tests-Add-the-tests-for-GIF-encoder-an.patch
patch_apply windowscodecs-GIF_Encoder/0027-windowscodecs-tests-Add-a-missing-check-for-IWICBitm.patch
patch_apply windowscodecs-GIF_Encoder/0028-windowscodecs-Correctly-indicate-that-the-global-inf.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in BMP encoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoderInfo::GetFileExtensions.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in JPEG encoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in TIFF encoder.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "windowscodecs/tests: Add IWICBitmapEncoderInfo test.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add initial implementation of the GIF encoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Initialize empty property bag in GIF encoder'\''s CreateNewFrame implementation.", 1 },';
@ -6620,17 +6574,13 @@ if test "$enable_windowscodecs_GIF_Encoder" -eq 1; then
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Fix the buffer size check in the TIFF decoder'\''s IWICBitmapFrameDecode::CopyPixels implementation.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add support for converting to 8bppIndexed format to IWICFormatConverter.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: WICConvertBitmapSource should ask IWICFormatConverter::Initialize to use an optimized palette.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the JPEG encoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the PNG encoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Improve stub for IWICBitmapDecoder::GetMetadataQueryReader in the PNG decoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Add registration of the GIF encoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Fix IWICBitmapDecoder::CopyPalette for a not initialized case in the GIF decoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Better follow the GIF spec and don'\''t specify the local color table size if there is no local palette.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Fix behaviour of format converter for indexed formats when NULL or empty palette has been provided.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add a bunch of new tests for indexed format conversions.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add some tests for converting 24bppBGR to 8bppIndexed format.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add the tests for GIF encoder and decoder.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs/tests: Add a missing check for IWICBitmapFrameDecode::GetPixelFormat return value.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: Correctly indicate that the global info was written even without the global palette.", 1 },';
) >> "$patchlist"
fi
@ -6660,7 +6610,7 @@ fi
# Patchset windowscodecs-TIFF_Support
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * windowscodecs-Palette_Images, windowscodecs-GIF_Encoder, windowscodecs-IWICPalette_InitializeFromBitmap
# | * windowscodecs-GIF_Encoder, windowscodecs-IWICPalette_InitializeFromBitmap
# |
# | Modified files:
# | * dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c, dlls/windowscodecs/metadatahandler.c, dlls/windowscodecs/regsvr.c,
@ -6706,8 +6656,7 @@ fi
# Patchset windowscodecs-32bppPRGBA
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * windowscodecs-Palette_Images, windowscodecs-GIF_Encoder, windowscodecs-IWICPalette_InitializeFromBitmap, windowscodecs-
# | TIFF_Support
# | * windowscodecs-GIF_Encoder, windowscodecs-IWICPalette_InitializeFromBitmap, windowscodecs-TIFF_Support
# |
# | Modified files:
# | * dlls/windowscodecs/converter.c, dlls/windowscodecs/info.c, dlls/windowscodecs/regsvr.c,

View File

@ -1,78 +0,0 @@
From b0160bd38c99d74d4f9edee766e1247856b443ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 19 Aug 2016 00:47:08 +0200
Subject: [PATCH] setupapi: SetupDiGetDeviceInterfaceDetail should fill out
DeviceInfoData even if the buffer for DeviceInterfaceData is too small.
---
dlls/setupapi/devinst.c | 14 ++++++++------
dlls/setupapi/tests/devinst.c | 7 +++++++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index fa4036b..42cf5dd 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -2819,9 +2819,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(HDEVINFO devinfo, SP_DEVICE_INTERFA
else
DeviceInterfaceDetailData->DevicePath[0] = '\0';
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
- copy_device_data(device_data, iface->device);
-
ret = TRUE;
}
else
@@ -2830,6 +2827,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(HDEVINFO devinfo, SP_DEVICE_INTERFA
*RequiredSize = bytesNeeded;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
}
+
+ if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
+ copy_device_data(device_data, iface->device);
+
return ret;
}
@@ -2874,9 +2875,6 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO devinfo, SP_DEVICE_INTERFA
else
DeviceInterfaceDetailData->DevicePath[0] = '\0';
- if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
- copy_device_data(device_data, iface->device);
-
ret = TRUE;
}
else
@@ -2885,6 +2883,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO devinfo, SP_DEVICE_INTERFA
*RequiredSize = bytesNeeded;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
}
+
+ if (device_data && device_data->cbSize == sizeof(SP_DEVINFO_DATA))
+ copy_device_data(device_data, iface->device);
+
return ret;
}
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 38be0a7..f523ef4 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -725,6 +725,13 @@ static void test_device_iface_detail(void)
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
ok(size == expectedsize, "Got unexpected size %d.\n", size);
+ memset(&device, 0, sizeof(device));
+ device.cbSize = sizeof(device);
+ ret = SetupDiGetDeviceInterfaceDetailW(set, &iface, NULL, 0, &size, &device);
+ ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
+ "Expected ERROR_INSUFFICIENT_BUFFER, got error code: %d\n", GetLastError());
+ ok(device.DevInst, "Expected DevInst to be set\n");
+
heap_free(detail);
SetupDiDestroyDeviceInfoList(set);
}
--
1.9.1

View File

@ -1,15 +1,15 @@
From ff6282f297e67822ee0def394a677a4fdc0fa609 Mon Sep 17 00:00:00 2001
From 39d690bf0ea117214e76419876188c7277ae1749 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 26 Jan 2017 19:01:21 +0800
Subject: windowscodecs: Fix 32bppRGB to 32bppRGBA conversion.
Subject: [PATCH] windowscodecs: Fix 32bppRGB to 32bppRGBA conversion.
---
dlls/windowscodecs/converter.c | 2 ++
dlls/windowscodecs/tests/converter.c | 45 +++++++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 1 deletion(-)
dlls/windowscodecs/tests/converter.c | 43 ++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index 519860d9065..1378c85bc2d 100644
index 47de603..d23c262 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -868,7 +868,9 @@ static HRESULT copypixels_to_32bppRGBA(struct FormatConverter *This, const WICRe
@ -23,10 +23,10 @@ index 519860d9065..1378c85bc2d 100644
return IWICBitmapSource_CopyPixels(This->source, prc, cbStride, cbBufferSize, pbBuffer);
return S_OK;
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index 1cafe90c734..17724d9ed01 100644
index 5480584..77db7e8 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -291,6 +291,21 @@ static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, cons
@@ -258,6 +258,21 @@ static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, cons
if (!equal && expect->alt_data)
equal = compare_bits(expect->alt_data, buffersize, converted_bits);
@ -48,21 +48,20 @@ index 1cafe90c734..17724d9ed01 100644
return equal;
}
@@ -438,6 +453,10 @@ static const BYTE bits_32bppBGR[] = {
0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80};
@@ -353,12 +368,34 @@ static const BYTE bits_32bppBGR[] = {
0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80};
static const struct bitmap_data testdata_32bppBGR = {
&GUID_WICPixelFormat32bppBGR, 32, bits_32bppBGR, 32, 2, 96.0, 96.0};
&GUID_WICPixelFormat32bppBGR, 32, bits_32bppBGR, 4, 2, 96.0, 96.0};
+static const struct bitmap_data testdata_32bppBGRA80 = {
+ &GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGR, 32, 2, 96.0, 96.0};
+static const struct bitmap_data testdata_32bppRGBA80 = {
+ &GUID_WICPixelFormat32bppRGBA, 32, bits_32bppBGR, 32, 2, 96.0, 96.0};
static const BYTE bits_32bppBGRA[] = {
255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
@@ -450,6 +469,24 @@ static const BYTE bits_32bppBGRA[] = {
0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255};
255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255};
static const struct bitmap_data testdata_32bppBGRA = {
&GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0};
&GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 4, 2, 96.0, 96.0};
+static const struct bitmap_data testdata_32bppRGBA = {
+ &GUID_WICPixelFormat32bppRGBA, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0};
+static const struct bitmap_data testdata_32bppRGB = {
@ -84,16 +83,7 @@ index 1cafe90c734..17724d9ed01 100644
/* XP and 2003 use linear color conversion, later versions use sRGB gamma */
static const float bits_32bppGrayFloat_xp[] = {
@@ -515,7 +552,7 @@ static void test_conversion(const struct bitmap_data *src, const struct bitmap_d
hr = WICConvertBitmapSource(dst->format, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
todo_wine_if (todo)
ok(hr == S_OK ||
- broken(hr == E_INVALIDARG) /* XP */, "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
+ broken(hr == E_INVALIDARG || hr == WINCODEC_ERR_COMPONENTNOTFOUND) /* XP */, "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
if (hr == S_OK)
{
@@ -1752,6 +1789,12 @@ START_TEST(converter)
@@ -1684,6 +1721,12 @@ START_TEST(converter)
test_conversion(&testdata_32bppBGRA, &testdata_32bppBGR, "BGRA -> BGR", FALSE);
test_conversion(&testdata_32bppBGR, &testdata_32bppBGRA, "BGR -> BGRA", FALSE);
test_conversion(&testdata_32bppBGRA, &testdata_32bppBGRA, "BGRA -> BGRA", FALSE);
@ -107,5 +97,5 @@ index 1cafe90c734..17724d9ed01 100644
test_conversion(&testdata_24bppBGR, &testdata_24bppBGR, "24bppBGR -> 24bppBGR", FALSE);
test_conversion(&testdata_24bppBGR, &testdata_24bppRGB, "24bppBGR -> 24bppRGB", FALSE);
--
2.11.0
1.9.1

View File

@ -1,44 +0,0 @@
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

@ -1,31 +0,0 @@
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

@ -1,44 +0,0 @@
From 5dcb81fa70edefd525cad861d7cac7706db47871 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 451d725eb8..a060d569f8 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -1392,11 +1392,22 @@ static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, G
return S_OK;
}
-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.14.1

View File

@ -1,44 +0,0 @@
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

@ -1,35 +0,0 @@
From e2d172c5ac68abd6205c2cb63e2a58597e64ec8c Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 21 Oct 2016 14:32:25 +0800
Subject: windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the
JPEG encoder.
---
dlls/windowscodecs/jpegformat.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index 45bb88f..2b1be0a 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -416,10 +416,14 @@ static HRESULT WINAPI JpegDecoder_CopyPalette(IWICBitmapDecoder *iface,
}
static HRESULT WINAPI JpegDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
- IWICMetadataQueryReader **ppIMetadataQueryReader)
+ IWICMetadataQueryReader **reader)
{
- FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
- return E_NOTIMPL;
+ FIXME("(%p,%p): stub\n", iface, reader);
+
+ if (!reader) return E_INVALIDARG;
+
+ *reader = NULL;
+ return WINCODEC_ERR_UNSUPPORTEDOPERATION;
}
static HRESULT WINAPI JpegDecoder_GetPreview(IWICBitmapDecoder *iface,
--
2.9.0

View File

@ -1,44 +0,0 @@
From 00ebc80c47100fe08c13f685ecd5b75fd94c6f13 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 21 Oct 2016 14:36:21 +0800
Subject: windowscodecs: Implement IWICBitmapEncoder::GetEncoderInfo in the PNG
encoder.
---
dlls/windowscodecs/pngformat.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index c0e5a59cf9..786d8360e0 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -1979,11 +1979,22 @@ static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GU
return S_OK;
}
-static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
- IWICBitmapEncoderInfo **ppIEncoderInfo)
+static HRESULT WINAPI PngEncoder_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_WICPngEncoder, &comp_info);
+ if (hr == S_OK)
+ {
+ hr = IWICComponentInfo_QueryInterface(comp_info, &IID_IWICBitmapEncoderInfo, (void **)info);
+ IWICComponentInfo_Release(comp_info);
+ }
+ return hr;
}
static HRESULT WINAPI PngEncoder_SetColorContexts(IWICBitmapEncoder *iface,
--
2.14.1

View File

@ -1,581 +0,0 @@
From 63254aa83cdb09ad7b0a56a6da1f0d8c7465733e Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 27 Oct 2016 15:10:09 +0800
Subject: windowscodecs/tests: Add a bunch of new tests for indexed format
conversions.
---
dlls/windowscodecs/tests/converter.c | 285 +++++++++++++++++++++++++----------
1 file changed, 209 insertions(+), 76 deletions(-)
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index feeca5b..e6d21ac 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -115,9 +115,30 @@ static HRESULT WINAPI BitmapTestSrc_GetResolution(IWICBitmapSource *iface,
}
static HRESULT WINAPI BitmapTestSrc_CopyPalette(IWICBitmapSource *iface,
- IWICPalette *pIPalette)
+ IWICPalette *palette)
{
- return E_NOTIMPL;
+ BitmapTestSrc *This = impl_from_IWICBitmapSource(iface);
+
+ if (IsEqualGUID(This->data->format, &GUID_WICPixelFormat1bppIndexed) ||
+ IsEqualGUID(This->data->format, &GUID_WICPixelFormat2bppIndexed) ||
+ IsEqualGUID(This->data->format, &GUID_WICPixelFormat4bppIndexed) ||
+ IsEqualGUID(This->data->format, &GUID_WICPixelFormat8bppIndexed))
+ {
+ WICColor colors[8];
+
+ colors[0] = 0xff0000ff;
+ colors[1] = 0xff00ff00;
+ colors[2] = 0xffff0000;
+ colors[3] = 0xff000000;
+ colors[4] = 0xffffff00;
+ colors[5] = 0xffff00ff;
+ colors[6] = 0xff00ffff;
+ colors[7] = 0xffffffff;
+ return IWICPalette_InitializeCustom(palette, colors, 8);
+ }
+
+ /* unique error marker */
+ return 0xdeadbeef;
}
static HRESULT WINAPI BitmapTestSrc_CopyPixels(IWICBitmapSource *iface,
@@ -249,6 +270,21 @@ static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, cons
break;
}
}
+ else if (IsEqualGUID(expect->format, &GUID_WICPixelFormat2bppIndexed) ||
+ IsEqualGUID(expect->format, &GUID_WICPixelFormat4bppIndexed) ||
+ IsEqualGUID(expect->format, &GUID_WICPixelFormat8bppIndexed))
+ {
+ UINT i;
+ const BYTE *a=(const BYTE*)expect->bits, *b=(const BYTE*)converted_bits;
+ equal=TRUE;
+
+ for (i=0; i<buffersize; i++)
+ if (a[i] != b[i])
+ {
+ equal = FALSE;
+ break;
+ }
+ }
else
equal = (memcmp(expect->bits, converted_bits, buffersize) == 0);
@@ -258,7 +294,19 @@ static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, cons
return equal;
}
-static void compare_bitmap_data(const struct bitmap_data *expect, IWICBitmapSource *source, const char *name)
+static BOOL is_indexed_format(const GUID *format)
+{
+ if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed) ||
+ IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed) ||
+ IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed) ||
+ IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void compare_bitmap_data(const struct bitmap_data *src, const struct bitmap_data *expect,
+ IWICBitmapSource *source, const char *name)
{
BYTE *converted_bits;
UINT width, height;
@@ -291,15 +339,24 @@ static void compare_bitmap_data(const struct bitmap_data *expect, IWICBitmapSour
buffersize = stride * expect->height;
converted_bits = HeapAlloc(GetProcessHeap(), 0, buffersize);
+ memset(converted_bits, 0xaa, buffersize);
hr = IWICBitmapSource_CopyPixels(source, &prc, stride, buffersize, converted_bits);
ok(SUCCEEDED(hr), "CopyPixels(%s) failed, hr=%x\n", name, hr);
- ok(compare_bits(expect, buffersize, converted_bits), "unexpected pixel data (%s)\n", name);
+
+ /* The result of conversion of color to indexed formats depends on
+ * optimized palette generation implementation. We either need to
+ * assign our own palette, or just skip the comparison.
+ */
+ if (!(!is_indexed_format(src->format) && is_indexed_format(expect->format)))
+ ok(compare_bits(expect, buffersize, converted_bits), "unexpected pixel data (%s)\n", name);
/* Test with NULL rectangle - should copy the whole bitmap */
memset(converted_bits, 0xaa, buffersize);
hr = IWICBitmapSource_CopyPixels(source, NULL, stride, buffersize, converted_bits);
ok(SUCCEEDED(hr), "CopyPixels(%s,rc=NULL) failed, hr=%x\n", name, hr);
- ok(compare_bits(expect, buffersize, converted_bits), "unexpected pixel data (%s)\n", name);
+ /* see comment above */
+ if (!(!is_indexed_format(src->format) && is_indexed_format(expect->format)))
+ ok(compare_bits(expect, buffersize, converted_bits), "unexpected pixel data (%s)\n", name);
HeapFree(GetProcessHeap(), 0, converted_bits);
}
@@ -315,78 +372,137 @@ static const struct bitmap_data testdata_1bppIndexed = {
/* some encoders (like BMP) require data to be 4-bytes aligned */
static const BYTE bits_2bpp[] = {
- 0x55,0x55,0x55,0x55,
- 0xaa,0xaa,0xaa,0xaa};
+ 0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,0xdb,
+ 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24};
static const struct bitmap_data testdata_2bppIndexed = {
- &GUID_WICPixelFormat2bppIndexed, 2, bits_2bpp, 16, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat2bppIndexed, 2, bits_2bpp, 32, 2, 96.0, 96.0};
/* some encoders (like BMP) require data to be 4-bytes aligned */
static const BYTE bits_4bpp[] = {
- 0x55,0x55,0x55,0x55,
- 0xaa,0xaa,0xaa,0xaa};
+ 0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,0x01,0x23,
+ 0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67,0x45,0x67};
+
static const struct bitmap_data testdata_4bppIndexed = {
- &GUID_WICPixelFormat4bppIndexed, 4, bits_4bpp, 8, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat4bppIndexed, 4, bits_4bpp, 32, 2, 96.0, 96.0};
+
+static const BYTE bits_8bpp_BW[] = {
+ 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
+ 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0};
+static const struct bitmap_data testdata_8bppIndexed_BW = {
+ &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp_BW, 32, 2, 96.0, 96.0};
+
+static const BYTE bits_8bpp_4colors[] = {
+ 0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,0,
+ 3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3,3,2,1,3};
+static const struct bitmap_data testdata_8bppIndexed_4colors = {
+ &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp_4colors, 32, 2, 96.0, 96.0};
static const BYTE bits_8bpp[] = {
- 0,1,2,3,
- 4,5,6,7};
+ 0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,
+ 4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7,4,5,6,7};
static const struct bitmap_data testdata_8bppIndexed = {
- &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat8bppIndexed, 8, bits_8bpp, 32, 2, 96.0, 96.0};
static const BYTE bits_24bppBGR[] = {
- 255,0,0, 0,255,0, 0,0,255, 0,0,0,
- 0,255,255, 255,0,255, 255,255,0, 255,255,255};
+ 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
+ 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
+ 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
+ 255,0,0, 0,255,0, 0,0,255, 0,0,0, 255,0,0, 0,255,0, 0,0,255, 0,0,0,
+ 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
+ 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
+ 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255,
+ 0,255,255, 255,0,255, 255,255,0, 255,255,255, 0,255,255, 255,0,255, 255,255,0, 255,255,255};
static const struct bitmap_data testdata_24bppBGR = {
- &GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR, 32, 2, 96.0, 96.0};
static const BYTE bits_24bppRGB[] = {
- 0,0,255, 0,255,0, 255,0,0, 0,0,0,
- 255,255,0, 255,0,255, 0,255,255, 255,255,255};
+ 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
+ 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
+ 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
+ 0,0,255, 0,255,0, 255,0,0, 0,0,0, 0,0,255, 0,255,0, 255,0,0, 0,0,0,
+ 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
+ 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
+ 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255,
+ 255,255,0, 255,0,255, 0,255,255, 255,255,255, 255,255,0, 255,0,255, 0,255,255, 255,255,255 };
static const struct bitmap_data testdata_24bppRGB = {
- &GUID_WICPixelFormat24bppRGB, 24, bits_24bppRGB, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat24bppRGB, 24, bits_24bppRGB, 32, 2, 96.0, 96.0};
static const BYTE bits_32bppBGR[] = {
- 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
- 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80};
+ 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
+ 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
+ 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
+ 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80, 255,0,0,80, 0,255,0,80, 0,0,255,80, 0,0,0,80,
+ 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80,
+ 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80,
+ 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80,
+ 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80, 0,255,255,80, 255,0,255,80, 255,255,0,80, 255,255,255,80};
static const struct bitmap_data testdata_32bppBGR = {
- &GUID_WICPixelFormat32bppBGR, 32, bits_32bppBGR, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat32bppBGR, 32, bits_32bppBGR, 32, 2, 96.0, 96.0};
static const BYTE bits_32bppBGRA[] = {
- 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
- 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255};
+ 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
+ 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
+ 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
+ 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255, 255,0,0,255, 0,255,0,255, 0,0,255,255, 0,0,0,255,
+ 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255,
+ 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255,
+ 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255,
+ 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255, 0,255,255,255, 255,0,255,255, 255,255,0,255, 255,255,255,255};
static const struct bitmap_data testdata_32bppBGRA = {
- &GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0};
/* XP and 2003 use linear color conversion, later versions use sRGB gamma */
static const float bits_32bppGrayFloat_xp[] = {
- 0.114000f,0.587000f,0.299000f,0.000000f,
- 0.886000f,0.413000f,0.701000f,1.000000f};
+ 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
+ 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
+ 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
+ 0.114000f,0.587000f,0.299000f,0.000000f,0.114000f,0.587000f,0.299000f,0.000000f,
+ 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
+ 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
+ 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f,
+ 0.886000f,0.413000f,0.701000f,1.000000f,0.886000f,0.413000f,0.701000f,1.000000f};
static const struct bitmap_data testdata_32bppGrayFloat_xp = {
- &GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat_xp, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat_xp, 32, 2, 96.0, 96.0};
static const float bits_32bppGrayFloat[] = {
- 0.072200f,0.715200f,0.212600f,0.000000f,
- 0.927800f,0.284800f,0.787400f,1.000000f};
+ 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
+ 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
+ 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
+ 0.072200f,0.715200f,0.212600f,0.000000f,0.072200f,0.715200f,0.212600f,0.000000f,
+ 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
+ 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
+ 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f,
+ 0.927800f,0.284800f,0.787400f,1.000000f,0.927800f,0.284800f,0.787400f,1.000000f};
static const struct bitmap_data testdata_32bppGrayFloat = {
- &GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat, 4, 2, 96.0, 96.0, &testdata_32bppGrayFloat_xp};
+ &GUID_WICPixelFormat32bppGrayFloat, 32, (const BYTE *)bits_32bppGrayFloat, 32, 2, 96.0, 96.0, &testdata_32bppGrayFloat_xp};
static const BYTE bits_8bppGray_xp[] = {
- 29,150,76,0,
- 226,105,179,255};
+ 29,150,76,0,29,150,76,0,29,150,76,0,29,150,76,0,
+ 29,150,76,0,29,150,76,0,29,150,76,0,29,150,76,0,
+ 226,105,179,255,226,105,179,255,226,105,179,255,226,105,179,255,
+ 226,105,179,255,226,105,179,255,226,105,179,255,226,105,179,255};
static const struct bitmap_data testdata_8bppGray_xp = {
- &GUID_WICPixelFormat8bppGray, 8, bits_8bppGray_xp, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat8bppGray, 8, bits_8bppGray_xp, 32, 2, 96.0, 96.0};
static const BYTE bits_8bppGray[] = {
- 76,220,127,0,
- 247,145,230,255};
+ 76,220,127,0,76,220,127,0,76,220,127,0,76,220,127,0,
+ 76,220,127,0,76,220,127,0,76,220,127,0,76,220,127,0,
+ 247,145,230,255,247,145,230,255,247,145,230,255,247,145,230,255,
+ 247,145,230,255,247,145,230,255,247,145,230,255,247,145,230,255};
static const struct bitmap_data testdata_8bppGray = {
- &GUID_WICPixelFormat8bppGray, 8, bits_8bppGray, 4, 2, 96.0, 96.0, &testdata_8bppGray_xp};
+ &GUID_WICPixelFormat8bppGray, 8, bits_8bppGray, 32, 2, 96.0, 96.0, &testdata_8bppGray_xp};
static const BYTE bits_24bppBGR_gray[] = {
- 76,76,76, 220,220,220, 127,127,127, 0,0,0,
- 247,247,247, 145,145,145, 230,230,230, 255,255,255};
+ 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
+ 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
+ 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
+ 76,76,76, 220,220,220, 127,127,127, 0,0,0, 76,76,76, 220,220,220, 127,127,127, 0,0,0,
+ 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
+ 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
+ 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255,
+ 247,247,247, 145,145,145, 230,230,230, 255,255,255, 247,247,247, 145,145,145, 230,230,230, 255,255,255};
static const struct bitmap_data testdata_24bppBGR_gray = {
- &GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR_gray, 4, 2, 96.0, 96.0};
+ &GUID_WICPixelFormat24bppBGR, 24, bits_24bppBGR_gray, 32, 2, 96.0, 96.0};
static void test_conversion(const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo)
{
@@ -398,11 +514,12 @@ static void test_conversion(const struct bitmap_data *src, const struct bitmap_d
hr = WICConvertBitmapSource(dst->format, &src_obj->IWICBitmapSource_iface, &dst_bitmap);
todo_wine_if (todo)
- ok(SUCCEEDED(hr), "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
+ ok(hr == S_OK ||
+ broken(hr == E_INVALIDARG) /* XP */, "WICConvertBitmapSource(%s) failed, hr=%x\n", name, hr);
- if (SUCCEEDED(hr))
+ if (hr == S_OK)
{
- compare_bitmap_data(dst, dst_bitmap, name);
+ compare_bitmap_data(src, dst, dst_bitmap, name);
IWICBitmapSource_Release(dst_bitmap);
}
@@ -450,7 +567,7 @@ static void test_default_converter(void)
ok(SUCCEEDED(hr), "Initialize returned %x\n", hr);
if (SUCCEEDED(hr))
- compare_bitmap_data(&testdata_32bppBGR, (IWICBitmapSource*)converter, "default converter");
+ compare_bitmap_data(&testdata_32bppBGRA, &testdata_32bppBGR, (IWICBitmapSource*)converter, "default converter");
IWICFormatConverter_Release(converter);
}
@@ -706,7 +823,7 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
{
- ok(width == 16, "wrong width %u\n", width);
+ ok(width == 32, "wrong width %u\n", width);
ok(height == 2, "wrong height %u\n", height);
ok(bps == 2, "wrong bps %d\n", bps);
@@ -716,7 +833,7 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
{
- ok(width == 8, "wrong width %u\n", width);
+ ok(width == 32, "wrong width %u\n", width);
ok(height == 2, "wrong height %u\n", height);
ok(bps == 4, "wrong bps %d\n", bps);
@@ -726,7 +843,7 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
{
- ok(width == 4, "wrong width %u\n", width);
+ ok(width == 32, "wrong width %u\n", width);
ok(height == 2, "wrong height %u\n", height);
ok(bps == 8, "wrong bps %d\n", bps);
@@ -736,7 +853,7 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat24bppBGR))
{
- ok(width == 4, "wrong width %u\n", width);
+ ok(width == 32, "wrong width %u\n", width);
ok(height == 2, "wrong height %u\n", height);
ok(bps == 3, "wrong bps %d\n", bps);
@@ -754,7 +871,6 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
BITMAPFILEHEADER bfh;
BITMAPV5HEADER bih;
- memset(&bfh, 0, sizeof(bfh));
hr = IStream_Read(stream, &bfh, sizeof(bfh), NULL);
ok(hr == S_OK, "IStream_Read error %#x\n", hr);
@@ -762,13 +878,12 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
ok(bfh.bfReserved1 == 0, "wrong bfReserved1 %02x\n", bfh.bfReserved1);
ok(bfh.bfReserved2 == 0, "wrong bfReserved2 %02x\n", bfh.bfReserved2);
- memset(&bih, 0, sizeof(bih));
hr = IStream_Read(stream, &bih, sizeof(bih), NULL);
ok(hr == S_OK, "IStream_Read error %#x\n", hr);
if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
{
- ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
@@ -780,9 +895,9 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
{
- ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
- ok(bih.bV5Width == 16, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
@@ -792,9 +907,9 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
{
- ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
- ok(bih.bV5Width == 8, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
@@ -804,9 +919,9 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
{
- ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %08x\n", bfh.bfOffBits);
- ok(bih.bV5Width == 4, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
@@ -816,9 +931,9 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat32bppBGR))
{
- ok(bfh.bfOffBits == 0x0036, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+ ok(bfh.bfOffBits == 0x0036, "wrong bfOffBits %08x\n", bfh.bfOffBits);
- ok(bih.bV5Width == 4, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
@@ -886,7 +1001,7 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
{
- ok(be_uint(png.width) == 16, "wrong width %u\n", be_uint(png.width));
+ ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
ok(png.bit_depth == 2, "wrong bit_depth %d\n", png.bit_depth);
@@ -897,7 +1012,7 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
{
- ok(be_uint(png.width) == 8, "wrong width %u\n", be_uint(png.width));
+ ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
ok(png.bit_depth == 4, "wrong bit_depth %d\n", png.bit_depth);
@@ -908,7 +1023,7 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
{
- ok(be_uint(png.width) == 4, "wrong width %u\n", be_uint(png.width));
+ ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
ok(png.bit_depth == 8, "wrong bit_depth %d\n", png.bit_depth);
@@ -919,7 +1034,7 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat24bppBGR))
{
- ok(be_uint(png.width) == 4, "wrong width %u\n", be_uint(png.width));
+ ok(be_uint(png.width) == 32, "wrong width %u\n", be_uint(png.width));
ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
ok(png.bit_depth == 8, "wrong bit_depth %d\n", png.bit_depth);
@@ -1054,8 +1169,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &pixelformat);
ok(SUCCEEDED(hr), "SetPixelFormat failed, hr=%x\n", hr);
ok(IsEqualGUID(&pixelformat, dsts[i]->format) ||
- broken(IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)) ||
- broken(IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
+ broken(IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)) ||
+ broken(IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
"SetPixelFormat changed the format to %s (%s)\n", wine_dbgstr_guid(&pixelformat), name);
hr = IWICBitmapFrameEncode_SetSize(frameencode, srcs[i]->width, srcs[i]->height);
@@ -1088,8 +1203,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(SUCCEEDED(hr), "WriteSource(%dx%d) failed, hr=%x (%s)\n", rc->Width, rc->Height, hr, name);
else
ok(hr == S_OK ||
- broken(hr == E_NOTIMPL && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2) ||
- broken(hr == E_NOTIMPL && IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) ||
+ broken(hr == E_INVALIDARG && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2) /* XP */ ||
+ broken(hr == E_INVALIDARG && IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) /* XP */ ||
broken(hr == E_INVALIDARG && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && IsEqualGUID(srcs[i]->format, &GUID_WICPixelFormatBlackWhite)) /* XP */,
"WriteSource(NULL) failed, hr=%x (%s)\n", hr, name);
}
@@ -1114,7 +1229,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
hr = IWICBitmapEncoder_Commit(encoder);
ok(SUCCEEDED(hr), "Commit failed, hr=%x\n", hr);
- check_bitmap_format(stream, clsid_encoder, dsts[0]->format);
+ if (IsEqualGUID(&pixelformat, dsts[0]->format))
+ check_bitmap_format(stream, clsid_encoder, dsts[0]->format);
}
if (SUCCEEDED(hr))
@@ -1149,7 +1265,9 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
if (SUCCEEDED(hr))
{
- compare_bitmap_data(dsts[i], (IWICBitmapSource*)framedecode, name);
+ hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &pixelformat);
+ if (IsEqualGUID(&pixelformat, dsts[i]->format))
+ compare_bitmap_data(srcs[i], dsts[i], (IWICBitmapSource*)framedecode, name);
hr = IWICBitmapFrameDecode_CopyPalette(framedecode, frame_palette);
if (winetest_debug > 1)
@@ -1197,8 +1315,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
else if (IsEqualGUID(clsid_decoder, &CLSID_WICBmpDecoder) ||
IsEqualGUID(clsid_decoder, &CLSID_WICTiffDecoder))
{
- if (IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormatBlackWhite) ||
- IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormat8bppIndexed))
+ if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormatBlackWhite) ||
+ IsEqualGUID(&pixelformat, &GUID_WICPixelFormat8bppIndexed))
{
ok(count == 256, "expected 256, got %u (%s)\n", count, name);
@@ -1209,7 +1327,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
}
- else if (IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormat2bppIndexed))
+ else if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormat2bppIndexed))
{
ok(count == 4, "expected 4, got %u (%s)\n", count, name);
@@ -1218,7 +1336,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(colors[2] == 0xff333333, "got %08x (%s)\n", colors[2], name);
ok(colors[3] == 0xff444444, "got %08x (%s)\n", colors[3], name);
}
- else if (IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormat4bppIndexed))
+ else if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed))
{
ok(count == 16, "expected 16, got %u (%s)\n", count, name);
@@ -1308,7 +1426,7 @@ static void test_encoder_rects(void)
rc.X = 0;
rc.Y = 0;
- rc.Width = 4;
+ rc.Width = 32;
rc.Height = 2;
test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects full", NULL);
@@ -1319,7 +1437,7 @@ static void test_encoder_rects(void)
rc.Width = -1;
test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects width=-1", NULL);
- rc.Width = 4;
+ rc.Width = 32;
rc.Height = 0;
test_multi_encoder(srcs, &CLSID_WICTiffEncoder, dsts, &CLSID_WICTiffDecoder, &rc, NULL, "test_encoder_rects height=0", NULL);
@@ -1351,6 +1469,16 @@ START_TEST(converter)
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "failed to create factory: %#x\n", hr);
+ test_conversion(&testdata_24bppRGB, &testdata_1bppIndexed, "24bppRGB -> 1bppIndexed", TRUE);
+ test_conversion(&testdata_24bppRGB, &testdata_2bppIndexed, "24bppRGB -> 2bppIndexed", TRUE);
+ test_conversion(&testdata_24bppRGB, &testdata_4bppIndexed, "24bppRGB -> 4bppIndexed", TRUE);
+ test_conversion(&testdata_24bppRGB, &testdata_8bppIndexed, "24bppRGB -> 8bppIndexed", FALSE);
+
+ test_conversion(&testdata_BlackWhite, &testdata_8bppIndexed_BW, "BlackWhite -> 8bppIndexed", TRUE);
+ test_conversion(&testdata_1bppIndexed, &testdata_8bppIndexed_BW, "1bppIndexed -> 8bppIndexed", TRUE);
+ test_conversion(&testdata_2bppIndexed, &testdata_8bppIndexed_4colors, "2bppIndexed -> 8bppIndexed", TRUE);
+ test_conversion(&testdata_4bppIndexed, &testdata_8bppIndexed, "4bppIndexed -> 8bppIndexed", TRUE);
+
test_conversion(&testdata_32bppBGRA, &testdata_32bppBGR, "BGRA -> BGR", FALSE);
test_conversion(&testdata_32bppBGR, &testdata_32bppBGRA, "BGR -> BGRA", FALSE);
test_conversion(&testdata_32bppBGRA, &testdata_32bppBGRA, "BGRA -> BGRA", FALSE);
@@ -1388,6 +1516,11 @@ START_TEST(converter)
&testdata_8bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 8bppIndexed");
test_encoder(&testdata_24bppBGR, &CLSID_WICPngEncoder,
&testdata_24bppBGR, &CLSID_WICPngDecoder, "PNG encoder 24bppBGR");
+if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in Wine */
+{
+ test_encoder(&testdata_32bppBGR, &CLSID_WICPngEncoder,
+ &testdata_24bppBGR, &CLSID_WICPngDecoder, "PNG encoder 32bppBGR");
+}
test_encoder(&testdata_BlackWhite, &CLSID_WICBmpEncoder,
&testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder BlackWhite");
--
2.9.0

View File

@ -1,18 +1,18 @@
From cf2301cafab21d7a67cf7a3b3a11db0ed17d0042 Mon Sep 17 00:00:00 2001
From e27b9d2889f424ecffabc57e449e995fab80274f Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 27 Oct 2016 15:13:24 +0800
Subject: windowscodecs/tests: Add some tests for converting 24bppBGR to
8bppIndexed format.
Subject: [PATCH] windowscodecs/tests: Add some tests for converting
24bppBGR to 8bppIndexed format.
---
dlls/windowscodecs/tests/converter.c | 159 +++++++++++++++++++++++++++++++++++
1 file changed, 159 insertions(+)
dlls/windowscodecs/tests/converter.c | 158 +++++++++++++++++++++++++++++++++++
1 file changed, 158 insertions(+)
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index e6d21ac..b8ed4d4 100644
index 4eea13b..089926b 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -1459,6 +1459,163 @@ static const struct setting png_interlace_settings[] = {
@@ -1468,6 +1468,163 @@ static const struct setting png_interlace_settings[] = {
{NULL}
};
@ -176,15 +176,14 @@ index e6d21ac..b8ed4d4 100644
START_TEST(converter)
{
HRESULT hr;
@@ -1469,6 +1626,8 @@ START_TEST(converter)
&IID_IWICImagingFactory, (void **)&factory);
ok(hr == S_OK, "failed to create factory: %#x\n", hr);
@@ -1502,6 +1659,7 @@ START_TEST(converter)
test_invalid_conversion();
test_default_converter();
+ test_converter_8bppIndexed();
+
test_conversion(&testdata_24bppRGB, &testdata_1bppIndexed, "24bppRGB -> 1bppIndexed", TRUE);
test_conversion(&testdata_24bppRGB, &testdata_2bppIndexed, "24bppRGB -> 2bppIndexed", TRUE);
test_conversion(&testdata_24bppRGB, &testdata_4bppIndexed, "24bppRGB -> 4bppIndexed", TRUE);
test_encoder(&testdata_BlackWhite, &CLSID_WICPngEncoder,
&testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
--
2.9.0
1.9.1

View File

@ -1,17 +1,18 @@
From e90eb83510bd3edbdc8ca8984cb9d0643b652fa1 Mon Sep 17 00:00:00 2001
From d9cd3ba23fa27fcffbe3d5dff9754c0520b3f92e Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 27 Oct 2016 15:17:19 +0800
Subject: windowscodecs/tests: Add the tests for GIF encoder and decoder.
Subject: [PATCH] windowscodecs/tests: Add the tests for GIF encoder and
decoder.
---
dlls/windowscodecs/tests/converter.c | 59 +++++++++++++++++++++++++++++++++---
1 file changed, 54 insertions(+), 5 deletions(-)
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index b8ed4d4..430c0ed 100644
index 089926b..5480584 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -1047,6 +1047,40 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
@@ -956,6 +956,40 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
ok(0, "unknown PNG pixel format %s\n", wine_dbgstr_guid(format));
}
@ -52,7 +53,7 @@ index b8ed4d4..430c0ed 100644
static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WICPixelFormatGUID *format)
{
HRESULT hr;
@@ -1062,6 +1096,8 @@ static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WIC
@@ -971,6 +1005,8 @@ static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WIC
check_bmp_format(stream, format);
else if (IsEqualGUID(encoder, &CLSID_WICTiffEncoder))
check_tiff_format(stream, format);
@ -61,7 +62,7 @@ index b8ed4d4..430c0ed 100644
else
ok(0, "unknown encoder %s\n", wine_dbgstr_guid(encoder));
@@ -1094,7 +1130,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
@@ -1089,7 +1125,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapEncoder, (void**)&encoder);
@ -70,7 +71,7 @@ index b8ed4d4..430c0ed 100644
if (SUCCEEDED(hr))
{
hglobal = GlobalAlloc(GMEM_MOVEABLE, 0);
@@ -1119,7 +1155,10 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
@@ -1116,7 +1152,10 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
if (palette)
{
hr = IWICBitmapEncoder_SetPalette(encoder, palette);
@ -82,7 +83,7 @@ index b8ed4d4..430c0ed 100644
hr = S_OK;
}
@@ -1248,13 +1287,19 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
@@ -1268,13 +1307,19 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(hr == S_OK, "CreatePalette error %#x\n", hr);
hr = IWICBitmapDecoder_CopyPalette(decoder, frame_palette);
@ -104,7 +105,7 @@ index b8ed4d4..430c0ed 100644
hr = S_OK;
i=0;
@@ -1313,7 +1358,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
@@ -1331,7 +1376,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
}
}
else if (IsEqualGUID(clsid_decoder, &CLSID_WICBmpDecoder) ||
@ -112,11 +113,11 @@ index b8ed4d4..430c0ed 100644
+ IsEqualGUID(clsid_decoder, &CLSID_WICTiffDecoder) ||
+ IsEqualGUID(clsid_decoder, &CLSID_WICGifDecoder))
{
if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormatBlackWhite) ||
IsEqualGUID(&pixelformat, &GUID_WICPixelFormat8bppIndexed))
@@ -1663,6 +1709,9 @@ START_TEST(converter)
test_invalid_conversion();
if (IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormatBlackWhite) ||
IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormat8bppIndexed))
@@ -1661,6 +1707,9 @@ START_TEST(converter)
test_default_converter();
test_converter_8bppIndexed();
+ test_encoder(&testdata_8bppIndexed, &CLSID_WICGifEncoder,
+ &testdata_8bppIndexed, &CLSID_WICGifDecoder, "GIF encoder 8bppIndexed");
@ -125,5 +126,5 @@ index b8ed4d4..430c0ed 100644
&testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
test_encoder(&testdata_1bppIndexed, &CLSID_WICPngEncoder,
--
2.9.0
1.9.1

View File

@ -1,25 +0,0 @@
From 18eb6add9eac40d84a809d75d340600e44cc1dae Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 6 Nov 2016 16:25:12 +0800
Subject: windowscodecs/tests: Add a missing check for
IWICBitmapFrameDecode::GetPixelFormat return value.
---
dlls/windowscodecs/tests/converter.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index 430c0ed..6d782f3 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -1311,6 +1311,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
if (SUCCEEDED(hr))
{
hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &pixelformat);
+ ok(hr == S_OK, "GetPixelFormat) failed, hr=%x (%s)\n", hr, name);
if (IsEqualGUID(&pixelformat, dsts[i]->format))
compare_bitmap_data(srcs[i], dsts[i], (IWICBitmapSource*)framedecode, name);
--
2.9.0

View File

@ -1,18 +1,18 @@
From 5855243712899817e834f024878f4f5e82f824e5 Mon Sep 17 00:00:00 2001
From ae0320150d2baec0415219ef3991431eb2ccc7af Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 6 Nov 2016 16:28:12 +0800
Subject: windowscodecs: Correctly indicate that the global info was written
even without the global palette.
Subject: [PATCH] windowscodecs: Correctly indicate that the global info
was written even without the global palette.
---
dlls/windowscodecs/gifformat.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c
index 9d0ae6b..efeddb0 100644
index 58144ca..6851296 100644
--- a/dlls/windowscodecs/gifformat.c
+++ b/dlls/windowscodecs/gifformat.c
@@ -2047,11 +2047,12 @@ static HRESULT WINAPI GifFrameEncode_Commit(IWICBitmapFrameEncode *iface)
@@ -2041,11 +2041,12 @@ static HRESULT WINAPI GifFrameEncode_Commit(IWICBitmapFrameEncode *iface)
gif_palette[i][2] = This->encoder->palette[i] & 0xff;
}
hr = IStream_Write(This->encoder->stream, gif_palette, sizeof(gif_palette), NULL);
@ -28,5 +28,5 @@ index 9d0ae6b..efeddb0 100644
if (hr == S_OK)
--
2.9.0
1.9.1

View File

@ -1,2 +1 @@
Fixes: Add initial implementation of GIF encoder to windowscodecs
Depends: windowscodecs-Palette_Images

View File

@ -1,459 +0,0 @@
From 6ef5ce21d7fbbdcf85d6666838a4149502c49785 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 22 Sep 2016 19:15:33 +0800
Subject: windowscodecs/tests: Add tests for encoding 2bpp/4bpp
images with a palette.
---
dlls/windowscodecs/tests/converter.c | 337 +++++++++++++++++++++++++++++------
1 file changed, 283 insertions(+), 54 deletions(-)
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index 5f9f1d88a3..9b8193d52c 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -316,6 +316,20 @@ static const struct bitmap_data testdata_BlackWhite = {
static const struct bitmap_data testdata_1bppIndexed = {
&GUID_WICPixelFormat1bppIndexed, 1, bits_1bpp, 32, 2, 96.0, 96.0};
+/* some encoders (like BMP) require data to be 4-bytes aligned */
+static const BYTE bits_2bpp[] = {
+ 0x55,0x55,0x55,0x55,
+ 0xaa,0xaa,0xaa,0xaa};
+static const struct bitmap_data testdata_2bppIndexed = {
+ &GUID_WICPixelFormat2bppIndexed, 2, bits_2bpp, 16, 2, 96.0, 96.0};
+
+/* some encoders (like BMP) require data to be 4-bytes aligned */
+static const BYTE bits_4bpp[] = {
+ 0x55,0x55,0x55,0x55,
+ 0xaa,0xaa,0xaa,0xaa};
+static const struct bitmap_data testdata_4bppIndexed = {
+ &GUID_WICPixelFormat4bppIndexed, 4, bits_4bpp, 8, 2, 96.0, 96.0};
+
static const BYTE bits_8bpp[] = {
0,1,2,3,
4,5,6,7};
@@ -632,64 +646,224 @@ static void test_encoder_properties(const CLSID* clsid_encoder, IPropertyBag2 *o
}
}
-static void check_bmp_format(IStream *stream, const struct bitmap_data *data)
+static void load_stream(IUnknown *reader, IStream *stream)
+{
+ HRESULT hr;
+ IWICPersistStream *persist;
+#ifdef WORDS_BIGENDIAN
+ DWORD persist_options = WICPersistOptionBigEndian;
+#else
+ DWORD persist_options = WICPersistOptionLittleEndian;
+#endif
+
+ hr = IUnknown_QueryInterface(reader, &IID_IWICPersistStream, (void **)&persist);
+ ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
+
+ hr = IWICPersistStream_LoadEx(persist, stream, NULL, persist_options);
+ ok(hr == S_OK, "LoadEx failed, hr=%x\n", hr);
+
+ IWICPersistStream_Release(persist);
+}
+
+static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
{
- BITMAPFILEHEADER bfh;
- BITMAPINFOHEADER bih;
HRESULT hr;
- ULONG len;
+ IWICMetadataReader *reader;
+ PROPVARIANT id, value;
+ struct
+ {
+ USHORT byte_order;
+ USHORT version;
+ ULONG dir_offset;
+ } tiff;
+ LARGE_INTEGER pos;
+ UINT count, i;
+ int width, height, bps, photo, samples, colormap;
+ struct
+ {
+ int id, *value;
+ } tag[] =
+ {
+ { 0x100, &width }, { 0x101, &height }, { 0x102, &bps },
+ { 0x106, &photo }, { 0x115, &samples }, { 0x140, &colormap }
+ };
+
+ memset(&tiff, 0, sizeof(tiff));
+ hr = IStream_Read(stream, &tiff, sizeof(tiff), NULL);
+ ok(hr == S_OK, "IStream_Read error %#x\n", hr);
+ ok(tiff.byte_order == MAKEWORD('I','I') || tiff.byte_order == MAKEWORD('M','M'),
+ "wrong TIFF byte order mark %02x\n", tiff.byte_order);
+ ok(tiff.version == 42, "wrong TIFF version %u\n", tiff.version);
+
+ pos.QuadPart = tiff.dir_offset;
+ hr = IStream_Seek(stream, pos, SEEK_SET, NULL);
+ ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
+
+ hr = CoCreateInstance(&CLSID_WICIfdMetadataReader, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IWICMetadataReader, (void **)&reader);
+ ok(hr == S_OK, "CoCreateInstance error %#x\n", hr);
+
+ load_stream((IUnknown *)reader, stream);
- hr = IStream_Read(stream, &bfh, sizeof(bfh), &len);
- ok(hr == S_OK, "Failed to read file header, hr %#x.\n", hr);
+ hr = IWICMetadataReader_GetCount(reader, &count);
+ ok(hr == S_OK, "GetCount error %#x\n", hr);
+ ok(count != 0, "wrong count %u\n", count);
- hr = IStream_Read(stream, &bih, sizeof(bih), &len);
- ok(hr == S_OK, "Failed to read file header, hr %#x.\n", hr);
+ for (i = 0; i < sizeof(tag)/sizeof(tag[0]); i++)
+ {
+ PropVariantInit(&id);
+ PropVariantInit(&value);
+
+ id.vt = VT_UI2;
+ U(id).uiVal = tag[i].id;
+ hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
+ ok(hr == S_OK || (tag[i].id == 0x140 && hr == WINCODEC_ERR_PROPERTYNOTFOUND),
+ "GetValue(%04x) error %#x\n", tag[i].id, hr);
+ if (hr == S_OK)
+ {
+ ok(value.vt == VT_UI2 || value.vt == VT_UI4 || value.vt == (VT_UI2 | VT_VECTOR), "wrong vt: %d\n", value.vt);
+ tag[i].value[0] = U(value).uiVal;
+ }
+ else
+ tag[i].value[0] = -1;
+ }
- ok(bfh.bfType == 0x4d42, "Unexpected header type, %#x.\n", bfh.bfType);
- ok(bfh.bfSize != 0, "Unexpected bitmap size %d.\n", bfh.bfSize);
- ok(bfh.bfReserved1 == 0, "Unexpected bfReserved1 field.\n");
- ok(bfh.bfReserved2 == 0, "Unexpected bfReserved2 field.\n");
+ IWICMetadataReader_Release(reader);
- if (IsEqualGUID(data->format, &GUID_WICPixelFormat1bppIndexed)
- || IsEqualGUID(data->format, &GUID_WICPixelFormat8bppIndexed))
+ if (IsEqualGUID(format, &GUID_WICPixelFormatBlackWhite))
{
- /* TODO: test with actual palette size */
- ok(bfh.bfOffBits > sizeof(bfh) + sizeof(bih), "Unexpected data offset %d, format %s.\n",
- bfh.bfOffBits, wine_dbgstr_guid(data->format));
+ ok(width == 32, "wrong width %u\n", width);
+ ok(height == 2, "wrong height %u\n", height);
+
+ ok(bps == 1, "wrong bps %d\n", bps);
+ ok(photo == 1, "wrong photometric %d\n", photo);
+ ok(samples == 1, "wrong samples %d\n", samples);
+ ok(colormap == -1, "wrong colormap %d\n", colormap);
}
- else
- ok(bfh.bfOffBits == sizeof(bfh) + sizeof(bih), "Unexpected data offset %d, format %s.\n",
- bfh.bfOffBits, wine_dbgstr_guid(data->format));
-
- ok(bih.biSize == sizeof(bih), "Unexpected header size %d.\n", bih.biSize);
- ok(bih.biWidth == data->width, "Unexpected bitmap width %d.\n", bih.biWidth);
- ok(bih.biHeight == data->height, "Unexpected bitmap height %d.\n", bih.biHeight);
- ok(bih.biPlanes == 1, "Unexpected planes count %d.\n", bih.biPlanes);
-
- if (IsEqualGUID(data->format, &GUID_WICPixelFormat1bppIndexed))
- ok(bih.biBitCount == 1, "Unexpected bit count %u, format %s.\n", bih.biBitCount,
- wine_dbgstr_guid(data->format));
- else if (IsEqualGUID(data->format, &GUID_WICPixelFormat8bppIndexed))
- ok(bih.biBitCount == 8, "Unexpected bit count %u, format %s.\n", bih.biBitCount,
- wine_dbgstr_guid(data->format));
- else if (IsEqualGUID(data->format, &GUID_WICPixelFormat32bppBGR))
- ok(bih.biBitCount == 32, "Unexpected bit count %u, format %s.\n", bih.biBitCount,
- wine_dbgstr_guid(data->format));
-
- ok(bih.biCompression == BI_RGB, "Unexpected compression mode %u.\n", bih.biCompression);
-todo_wine
- ok(bih.biSizeImage == 0, "Unexpected image size %d.\n", bih.biSizeImage);
- ok(bih.biXPelsPerMeter == 3780 || broken(bih.biXPelsPerMeter == 0) /* XP */, "Unexpected horz resolution %d.\n",
- bih.biXPelsPerMeter);
- ok(bih.biYPelsPerMeter == 3780 || broken(bih.biYPelsPerMeter == 0) /* XP */, "Unexpected vert resolution %d.\n",
- bih.biYPelsPerMeter);
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
+ {
+ ok(width == 32, "wrong width %u\n", width);
+ ok(height == 2, "wrong height %u\n", height);
+
+ ok(bps == 1, "wrong bps %d\n", bps);
+ ok(photo == 3, "wrong photometric %d\n", photo);
+ ok(samples == 1, "wrong samples %d\n", samples);
+ ok(colormap == 6, "wrong colormap %d\n", colormap);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
+ {
+ ok(width == 32, "wrong width %u\n", width);
+ ok(height == 2, "wrong height %u\n", height);
+
+ ok(bps == 1, "wrong bps %d\n", bps);
+ ok(photo == 3, "wrong photometric %d\n", photo);
+ ok(samples == 1, "wrong samples %d\n", samples);
+ ok(colormap == 6, "wrong colormap %d\n", colormap);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
+ {
+ ok(width == 8, "wrong width %u\n", width);
+ ok(height == 2, "wrong height %u\n", height);
- /* FIXME: test actual data */
+ ok(bps == 4, "wrong bps %d\n", bps);
+ ok(photo == 3, "wrong photometric %d\n", photo);
+ ok(samples == 1, "wrong samples %d\n", samples);
+ ok(colormap == 48, "wrong colormap %d\n", colormap);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
+ {
+ ok(width == 4, "wrong width %u\n", width);
+ ok(height == 2, "wrong height %u\n", height);
+
+ ok(bps == 8, "wrong bps %d\n", bps);
+ ok(photo == 3, "wrong photometric %d\n", photo);
+ ok(samples == 1, "wrong samples %d\n", samples);
+ ok(colormap == 768, "wrong colormap %d\n", colormap);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat24bppBGR))
+ {
+ ok(width == 4, "wrong width %u\n", width);
+ ok(height == 2, "wrong height %u\n", height);
+
+ ok(bps == 3, "wrong bps %d\n", bps);
+ ok(photo == 2, "wrong photometric %d\n", photo);
+ ok(samples == 3, "wrong samples %d\n", samples);
+ ok(colormap == -1, "wrong colormap %d\n", colormap);
+ }
+ else
+ ok(0, "unknown TIFF pixel format %s\n", wine_dbgstr_guid(format));
}
-static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
+static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
{
- /* FIXME */
+ HRESULT hr;
+ BITMAPFILEHEADER bfh;
+ BITMAPV5HEADER bih;
+
+ memset(&bfh, 0, sizeof(bfh));
+ hr = IStream_Read(stream, &bfh, sizeof(bfh), NULL);
+ ok(hr == S_OK, "IStream_Read error %#x\n", hr);
+
+ ok(bfh.bfType == 0x4d42, "wrong BMP signature %02x\n", bfh.bfType);
+ ok(bfh.bfReserved1 == 0, "wrong bfReserved1 %02x\n", bfh.bfReserved1);
+ ok(bfh.bfReserved2 == 0, "wrong bfReserved2 %02x\n", bfh.bfReserved2);
+
+ memset(&bih, 0, sizeof(bih));
+ hr = IStream_Read(stream, &bih, sizeof(bih), NULL);
+ ok(hr == S_OK, "IStream_Read error %#x\n", hr);
+
+ if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
+ {
+ ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
+
+ ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
+ ok(bih.bV5BitCount == 1, "wrong BitCount %d\n", bih.bV5BitCount);
+ ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
+ ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
+ {
+ ok(bih.bV5Width == 16, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
+
+ ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
+ ok(bih.bV5BitCount == 2, "wrong BitCount %d\n", bih.bV5BitCount);
+ ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
+ ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
+ {
+ ok(bih.bV5Width == 8, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
+
+ ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
+ ok(bih.bV5BitCount == 4, "wrong BitCount %d\n", bih.bV5BitCount);
+ ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
+ ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
+ {
+ ok(bih.bV5Width == 4, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
+
+ ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
+ ok(bih.bV5BitCount == 8, "wrong BitCount %d\n", bih.bV5BitCount);
+ ok(bih.bV5ClrUsed == 256, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
+ ok(bih.bV5ClrImportant == 256, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat32bppBGR))
+ {
+ ok(bih.bV5Width == 4, "wrong width %u\n", bih.bV5Width);
+ ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
+
+ ok(bih.bV5Planes == 1, "wrong Planes %d\n", bih.bV5Planes);
+ ok(bih.bV5BitCount == 32, "wrong BitCount %d\n", bih.bV5BitCount);
+ ok(bih.bV5ClrUsed == 0, "wrong ClrUsed %d\n", bih.bV5ClrUsed);
+ ok(bih.bV5ClrImportant == 0, "wrong ClrImportant %d\n", bih.bV5ClrImportant);
+ }
+ else
+ ok(0, "unknown BMP pixel format %s\n", wine_dbgstr_guid(format));
}
static unsigned be_uint(unsigned val)
@@ -746,6 +920,28 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
ok(png.filter == 0, "wrong filter %d\n", png.filter);
ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
}
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
+ {
+ ok(be_uint(png.width) == 16, "wrong width %u\n", be_uint(png.width));
+ ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
+
+ ok(png.bit_depth == 2, "wrong bit_depth %d\n", png.bit_depth);
+ ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
+ ok(png.compression == 0, "wrong compression %d\n", png.compression);
+ ok(png.filter == 0, "wrong filter %d\n", png.filter);
+ ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
+ }
+ else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
+ {
+ ok(be_uint(png.width) == 8, "wrong width %u\n", be_uint(png.width));
+ ok(be_uint(png.height) == 2, "wrong height %u\n", be_uint(png.height));
+
+ ok(png.bit_depth == 4, "wrong bit_depth %d\n", png.bit_depth);
+ ok(png.color_type == 3, "wrong color_type %d\n", png.color_type);
+ ok(png.compression == 0, "wrong compression %d\n", png.compression);
+ ok(png.filter == 0, "wrong filter %d\n", png.filter);
+ ok(png.interlace == 0, "wrong interlace %d\n", png.interlace);
+ }
else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
{
ok(be_uint(png.width) == 4, "wrong width %u\n", be_uint(png.width));
@@ -772,7 +968,7 @@ static void check_png_format(IStream *stream, const WICPixelFormatGUID *format)
ok(0, "unknown PNG pixel format %s\n", wine_dbgstr_guid(format));
}
-static void check_bitmap_format(IStream *stream, const CLSID *encoder, const struct bitmap_data *dst)
+static void check_bitmap_format(IStream *stream, const CLSID *encoder, const WICPixelFormatGUID *format)
{
HRESULT hr;
LARGE_INTEGER pos;
@@ -782,11 +978,11 @@ static void check_bitmap_format(IStream *stream, const CLSID *encoder, const str
ok(hr == S_OK, "IStream_Seek error %#x\n", hr);
if (IsEqualGUID(encoder, &CLSID_WICPngEncoder))
- check_png_format(stream, dst->format);
+ check_png_format(stream, format);
else if (IsEqualGUID(encoder, &CLSID_WICBmpEncoder))
- check_bmp_format(stream, dst);
+ check_bmp_format(stream, format);
else if (IsEqualGUID(encoder, &CLSID_WICTiffEncoder))
- check_tiff_format(stream, dst->format);
+ check_tiff_format(stream, format);
else
ok(0, "unknown encoder %s\n", wine_dbgstr_guid(encoder));
@@ -991,6 +1187,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(SUCCEEDED(hr), "WriteSource(%dx%d) failed, hr=%x (%s)\n", rc->Width, rc->Height, hr, name);
else
ok(hr == S_OK ||
+ broken(hr == E_NOTIMPL && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2) ||
+ broken(hr == E_NOTIMPL && IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2) ||
broken(hr == E_INVALIDARG && IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && IsEqualGUID(srcs[i]->format, &GUID_WICPixelFormatBlackWhite)) /* XP */,
"WriteSource(NULL) failed, hr=%x (%s)\n", hr, name);
}
@@ -1022,7 +1220,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
hr = IWICBitmapEncoder_Commit(encoder);
ok(SUCCEEDED(hr), "Commit failed, hr=%x\n", hr);
- check_bitmap_format(stream, clsid_encoder, dsts[0]);
+ check_bitmap_format(stream, clsid_encoder, dsts[0]->format);
}
if (SUCCEEDED(hr))
@@ -1082,7 +1280,12 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(ret == count, "expected %u, got %u\n", count, ret);
if (IsEqualGUID(clsid_decoder, &CLSID_WICPngDecoder))
{
- ok(count == 256 || count == 2 /* newer libpng versions */, "expected 256, got %u (%s)\n", count, name);
+ /* Newer libpng versions don't accept larger palettes than the declared
+ * bit depth, so we need to generate the palette of the correct length.
+ */
+ ok(count == 256 || (dsts[i]->bpp == 1 && count == 2) ||
+ (dsts[i]->bpp == 2 && count == 4) || (dsts[i]->bpp == 4 && count == 16),
+ "expected 256, got %u (%s)\n", count, name);
ok(colors[0] == 0x11111111, "got %08x (%s)\n", colors[0], name);
ok(colors[1] == 0x22222222, "got %08x (%s)\n", colors[1], name);
@@ -1090,8 +1293,11 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
{
ok(colors[2] == 0x33333333, "got %08x (%s)\n", colors[2], name);
ok(colors[3] == 0x44444444, "got %08x (%s)\n", colors[3], name);
- ok(colors[4] == 0x55555555, "got %08x (%s)\n", colors[4], name);
- ok(colors[5] == 0, "got %08x (%s)\n", colors[5], name);
+ if (count > 4)
+ {
+ ok(colors[4] == 0x55555555, "got %08x (%s)\n", colors[4], name);
+ ok(colors[5] == 0, "got %08x (%s)\n", colors[5], name);
+ }
}
}
else if (IsEqualGUID(clsid_decoder, &CLSID_WICBmpDecoder) ||
@@ -1109,6 +1315,17 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
}
+ else if (IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormat4bppIndexed))
+ {
+ ok(count == 16, "expected 16, got %u (%s)\n", count, name);
+
+ ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
+ ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
+ ok(colors[2] == 0xff333333, "got %08x (%s)\n", colors[2], name);
+ ok(colors[3] == 0xff444444, "got %08x (%s)\n", colors[3], name);
+ ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
+ ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
+ }
else
{
ok(count == 2, "expected 2, got %u (%s)\n", count, name);
@@ -1260,6 +1477,10 @@ START_TEST(converter)
&testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
test_encoder(&testdata_1bppIndexed, &CLSID_WICPngEncoder,
&testdata_1bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 1bppIndexed");
+ test_encoder(&testdata_2bppIndexed, &CLSID_WICPngEncoder,
+ &testdata_2bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 2bppIndexed");
+ test_encoder(&testdata_4bppIndexed, &CLSID_WICPngEncoder,
+ &testdata_4bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 4bppIndexed");
test_encoder(&testdata_8bppIndexed, &CLSID_WICPngEncoder,
&testdata_8bppIndexed, &CLSID_WICPngDecoder, "PNG encoder 8bppIndexed");
test_encoder(&testdata_24bppBGR, &CLSID_WICPngEncoder,
@@ -1271,6 +1492,10 @@ if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in
&testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder BlackWhite");
test_encoder(&testdata_1bppIndexed, &CLSID_WICBmpEncoder,
&testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 1bppIndexed");
+ test_encoder(&testdata_2bppIndexed, &CLSID_WICBmpEncoder,
+ &testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 2bppIndexed");
+ test_encoder(&testdata_4bppIndexed, &CLSID_WICBmpEncoder,
+ &testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 4bppIndexed");
test_encoder(&testdata_8bppIndexed, &CLSID_WICBmpEncoder,
&testdata_8bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 8bppIndexed");
}
@@ -1283,6 +1508,10 @@ if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in
{
test_encoder(&testdata_1bppIndexed, &CLSID_WICTiffEncoder,
&testdata_1bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 1bppIndexed");
+ test_encoder(&testdata_2bppIndexed, &CLSID_WICTiffEncoder,
+ &testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 2bppIndexed");
+ test_encoder(&testdata_4bppIndexed, &CLSID_WICTiffEncoder,
+ &testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 4bppIndexed");
test_encoder(&testdata_8bppIndexed, &CLSID_WICTiffEncoder,
&testdata_8bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 8bppIndexed");
}
--
2.16.2

View File

@ -1,163 +0,0 @@
From 53055fb4a5416b70107ca831982a056d38bab210 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 23 Sep 2016 16:36:50 +0800
Subject: windowscodecs: Add support for palette image formats to TIFF encoder.
---
dlls/windowscodecs/regsvr.c | 6 ++++++
dlls/windowscodecs/tests/converter.c | 25 ++++++++++++++++---------
dlls/windowscodecs/tiffformat.c | 26 ++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index b011d71645..b32b294d72 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1211,6 +1211,8 @@ static GUID const * const tiff_decode_formats[] = {
&GUID_WICPixelFormatBlackWhite,
&GUID_WICPixelFormat4bppGray,
&GUID_WICPixelFormat8bppGray,
+ &GUID_WICPixelFormat1bppIndexed,
+ &GUID_WICPixelFormat2bppIndexed,
&GUID_WICPixelFormat4bppIndexed,
&GUID_WICPixelFormat8bppIndexed,
&GUID_WICPixelFormat24bppBGR,
@@ -1370,6 +1372,10 @@ 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,
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index 9b8193d52c..c4cae4f330 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -752,13 +752,13 @@ static void check_tiff_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
{
- ok(width == 32, "wrong width %u\n", width);
+ ok(width == 16, "wrong width %u\n", width);
ok(height == 2, "wrong height %u\n", height);
- ok(bps == 1, "wrong bps %d\n", bps);
+ ok(bps == 2, "wrong bps %d\n", bps);
ok(photo == 3, "wrong photometric %d\n", photo);
ok(samples == 1, "wrong samples %d\n", samples);
- ok(colormap == 6, "wrong colormap %d\n", colormap);
+ ok(colormap == 12, "wrong colormap %d\n", colormap);
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
{
@@ -1151,8 +1151,9 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
memcpy(&pixelformat, srcs[i]->format, sizeof(GUID));
hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &pixelformat);
ok(SUCCEEDED(hr), "SetPixelFormat failed, hr=%x\n", hr);
- ok(IsEqualGUID(&pixelformat, dsts[i]->format), "SetPixelFormat changed the format to %s (%s)\n",
- wine_dbgstr_guid(&pixelformat), name);
+ ok(IsEqualGUID(&pixelformat, dsts[i]->format) ||
+ broken(IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
+ "SetPixelFormat changed the format to %s (%s)\n", wine_dbgstr_guid(&pixelformat), name);
hr = IWICBitmapFrameEncode_SetSize(frameencode, srcs[i]->width, srcs[i]->height);
ok(SUCCEEDED(hr), "SetSize failed, hr=%x\n", hr);
@@ -1315,6 +1316,15 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
ok(colors[4] == 0xff555555, "got %08x (%s)\n", colors[4], name);
ok(colors[5] == 0xff000000, "got %08x (%s)\n", colors[5], name);
}
+ else if (IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormat2bppIndexed))
+ {
+ ok(count == 4, "expected 4, got %u (%s)\n", count, name);
+
+ ok(colors[0] == 0xff111111, "got %08x (%s)\n", colors[0], name);
+ ok(colors[1] == 0xff222222, "got %08x (%s)\n", colors[1], name);
+ ok(colors[2] == 0xff333333, "got %08x (%s)\n", colors[2], name);
+ ok(colors[3] == 0xff444444, "got %08x (%s)\n", colors[3], name);
+ }
else if (IsEqualGUID(dsts[i]->format, &GUID_WICPixelFormat4bppIndexed))
{
ok(count == 16, "expected 16, got %u (%s)\n", count, name);
@@ -1504,17 +1514,14 @@ if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in
test_encoder(&testdata_BlackWhite, &CLSID_WICTiffEncoder,
&testdata_BlackWhite, &CLSID_WICTiffDecoder, "TIFF encoder BlackWhite");
-if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in Wine */
-{
test_encoder(&testdata_1bppIndexed, &CLSID_WICTiffEncoder,
&testdata_1bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 1bppIndexed");
test_encoder(&testdata_2bppIndexed, &CLSID_WICTiffEncoder,
- &testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 2bppIndexed");
+ &testdata_2bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 2bppIndexed");
test_encoder(&testdata_4bppIndexed, &CLSID_WICTiffEncoder,
&testdata_4bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 4bppIndexed");
test_encoder(&testdata_8bppIndexed, &CLSID_WICTiffEncoder,
&testdata_8bppIndexed, &CLSID_WICTiffDecoder, "TIFF encoder 8bppIndexed");
-}
test_encoder(&testdata_24bppBGR, &CLSID_WICTiffEncoder,
&testdata_24bppBGR, &CLSID_WICTiffDecoder, "TIFF encoder 24bppBGR");
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 2238a0eaa8..c9d0889b1e 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1,5 +1,6 @@
/*
* 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
@@ -461,6 +462,12 @@ 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;
@@ -1417,6 +1424,10 @@ 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}
};
@@ -1699,6 +1710,21 @@ 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;
}
--
2.16.2

View File

@ -1,253 +0,0 @@
From 621820e1345fb06680ec25c3c5690a928a2b1141 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 23 Sep 2016 20:17:47 +0800
Subject: windowscodecs: Add support for palette image formats to BMP encoder.
---
dlls/windowscodecs/bmpencode.c | 44 ++++++++++++++++++++++++++++--------
dlls/windowscodecs/info.c | 8 ++++++-
dlls/windowscodecs/regsvr.c | 5 ++++
dlls/windowscodecs/tests/converter.c | 18 +++++++++++----
4 files changed, 60 insertions(+), 15 deletions(-)
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c
index 97f30d7197..86e42b9a68 100644
--- a/dlls/windowscodecs/bmpencode.c
+++ b/dlls/windowscodecs/bmpencode.c
@@ -1,5 +1,6 @@
/*
* 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
@@ -37,6 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
struct bmp_pixelformat {
const WICPixelFormatGUID *guid;
UINT bpp;
+ UINT colors; /* palette size */
DWORD compression;
DWORD redmask;
DWORD greenmask;
@@ -45,13 +47,18 @@ struct bmp_pixelformat {
};
static const struct bmp_pixelformat formats[] = {
- {&GUID_WICPixelFormat24bppBGR, 24, BI_RGB},
- {&GUID_WICPixelFormat16bppBGR555, 16, BI_RGB},
- {&GUID_WICPixelFormat16bppBGR565, 16, BI_BITFIELDS, 0xf800, 0x7e0, 0x1f, 0},
- {&GUID_WICPixelFormat32bppBGR, 32, BI_RGB},
+ {&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},
#if 0
/* Windows doesn't seem to support this one. */
- {&GUID_WICPixelFormat32bppBGRA, 32, BI_BITFIELDS, 0xff0000, 0xff00, 0xff, 0xff000000},
+ {&GUID_WICPixelFormat32bppBGRA, 32, 0, BI_BITFIELDS, 0xff0000, 0xff00, 0xff, 0xff000000},
#endif
{NULL}
};
@@ -184,11 +191,13 @@ static HRESULT WINAPI BmpFrameEncode_SetPixelFormat(IWICBitmapFrameEncode *iface
for (i=0; formats[i].guid; i++)
{
- if (memcmp(formats[i].guid, pPixelFormat, sizeof(GUID)) == 0)
+ if (IsEqualGUID(formats[i].guid, pPixelFormat))
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));
@@ -207,6 +216,7 @@ static HRESULT WINAPI BmpFrameEncode_SetPalette(IWICBitmapFrameEncode *iface,
IWICPalette *palette)
{
BmpFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
+ HRESULT hr;
TRACE("(%p,%p)\n", iface, palette);
@@ -215,7 +225,14 @@ static HRESULT WINAPI BmpFrameEncode_SetPalette(IWICBitmapFrameEncode *iface,
if (!This->initialized)
return WINCODEC_ERR_NOTINITIALIZED;
- return IWICPalette_GetColors(palette, 256, This->palette, &This->colors);
+ 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;
}
static HRESULT WINAPI BmpFrameEncode_SetThumbnail(IWICBitmapFrameEncode *iface,
@@ -330,8 +347,8 @@ static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface)
bih.bV5SizeImage = This->stride*This->height;
bih.bV5XPelsPerMeter = (This->xres+0.0127) / 0.0254;
bih.bV5YPelsPerMeter = (This->yres+0.0127) / 0.0254;
- bih.bV5ClrUsed = 0;
- bih.bV5ClrImportant = 0;
+ bih.bV5ClrUsed = (This->format->bpp <= 8) ? This->colors : 0;
+ bih.bV5ClrImportant = bih.bV5ClrUsed;
if (This->format->compression == BI_BITFIELDS)
{
@@ -348,6 +365,7 @@ 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);
@@ -361,6 +379,14 @@ 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;
+ }
+
hr = IStream_Write(This->stream, This->bits, bih.bV5SizeImage, &byteswritten);
if (FAILED(hr)) return hr;
if (byteswritten != bih.bV5SizeImage) return E_FAIL;
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
index 6ddfdda25f..fbd0da97cf 100644
--- a/dlls/windowscodecs/info.c
+++ b/dlls/windowscodecs/info.c
@@ -2280,6 +2280,12 @@ 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;
@@ -2295,7 +2301,7 @@ HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitma
res = IWICBitmapSource_GetPixelFormat(pISrc, &srcFormat);
if (FAILED(res)) return res;
- if (IsEqualGUID(&srcFormat, dstFormat))
+ if (IsEqualGUID(&srcFormat, dstFormat) || (is_1bpp_format(&srcFormat) && is_1bpp_format(dstFormat)))
{
IWICBitmapSource_AddRef(pISrc);
*ppIDst = pISrc;
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index b32b294d72..c72fbf1899 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1347,6 +1347,11 @@ static GUID const * const bmp_encode_formats[] = {
&GUID_WICPixelFormat16bppBGR565,
&GUID_WICPixelFormat24bppBGR,
&GUID_WICPixelFormat32bppBGR,
+ &GUID_WICPixelFormatBlackWhite,
+ &GUID_WICPixelFormat1bppIndexed,
+ &GUID_WICPixelFormat2bppIndexed,
+ &GUID_WICPixelFormat4bppIndexed,
+ &GUID_WICPixelFormat8bppIndexed,
NULL
};
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index c4cae4f330..80ef61087d 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -814,6 +814,8 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
if (IsEqualGUID(format, &GUID_WICPixelFormat1bppIndexed))
{
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+
ok(bih.bV5Width == 32, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
@@ -824,6 +826,8 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat2bppIndexed))
{
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+
ok(bih.bV5Width == 16, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
@@ -834,6 +838,8 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat4bppIndexed))
{
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+
ok(bih.bV5Width == 8, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
@@ -844,6 +850,8 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat8bppIndexed))
{
+ ok(bfh.bfOffBits == 0x0436, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+
ok(bih.bV5Width == 4, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
@@ -854,6 +862,8 @@ static void check_bmp_format(IStream *stream, const WICPixelFormatGUID *format)
}
else if (IsEqualGUID(format, &GUID_WICPixelFormat32bppBGR))
{
+ ok(bfh.bfOffBits == 0x0036, "wrong bfOffBits %02x\n", bfh.bfOffBits);
+
ok(bih.bV5Width == 4, "wrong width %u\n", bih.bV5Width);
ok(bih.bV5Height == 2, "wrong height %u\n", bih.bV5Height);
@@ -1152,7 +1162,8 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
hr = IWICBitmapFrameEncode_SetPixelFormat(frameencode, &pixelformat);
ok(SUCCEEDED(hr), "SetPixelFormat failed, hr=%x\n", hr);
ok(IsEqualGUID(&pixelformat, dsts[i]->format) ||
- broken(IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
+ broken(IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)) ||
+ broken(IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder) && srcs[i]->bpp == 2 && IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed)),
"SetPixelFormat changed the format to %s (%s)\n", wine_dbgstr_guid(&pixelformat), name);
hr = IWICBitmapFrameEncode_SetSize(frameencode, srcs[i]->width, srcs[i]->height);
@@ -1496,19 +1507,16 @@ START_TEST(converter)
test_encoder(&testdata_24bppBGR, &CLSID_WICPngEncoder,
&testdata_24bppBGR, &CLSID_WICPngDecoder, "PNG encoder 24bppBGR");
-if (!strcmp(winetest_platform, "windows")) /* FIXME: enable once implemented in Wine */
-{
test_encoder(&testdata_BlackWhite, &CLSID_WICBmpEncoder,
&testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder BlackWhite");
test_encoder(&testdata_1bppIndexed, &CLSID_WICBmpEncoder,
&testdata_1bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 1bppIndexed");
test_encoder(&testdata_2bppIndexed, &CLSID_WICBmpEncoder,
- &testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 2bppIndexed");
+ &testdata_2bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 2bppIndexed");
test_encoder(&testdata_4bppIndexed, &CLSID_WICBmpEncoder,
&testdata_4bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 4bppIndexed");
test_encoder(&testdata_8bppIndexed, &CLSID_WICBmpEncoder,
&testdata_8bppIndexed, &CLSID_WICBmpDecoder, "BMP encoder 8bppIndexed");
-}
test_encoder(&testdata_32bppBGR, &CLSID_WICBmpEncoder,
&testdata_32bppBGR, &CLSID_WICBmpDecoder, "BMP encoder 32bppBGR");
--
2.16.2

View File

@ -1,2 +0,0 @@
Fixes: Improve palette support in windowscodecs.dll

View File

@ -1,8 +1,8 @@
From d57197600db7bb0c9f5f3c935ea568cf526d7cb9 Mon Sep 17 00:00:00 2001
From 56e077897f2c8d6821724de4b846b69f7f052747 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 9 Dec 2016 12:52:36 +0800
Subject: windowscodecs: Add support for 32bppCMYK and 64bppCMYK formats to
TIFF decoder.
Subject: [PATCH] windowscodecs: Add support for 32bppCMYK and 64bppCMYK
formats to TIFF decoder.
---
dlls/windowscodecs/regsvr.c | 13 +++++++++++++
@ -11,7 +11,7 @@ Subject: windowscodecs: Add support for 32bppCMYK and 64bppCMYK formats to
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index f695d3e40a..9024574e80 100644
index cfb3e26..4ea51f6 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1224,6 +1224,8 @@ static GUID const * const tiff_decode_formats[] = {
@ -23,7 +23,7 @@ index f695d3e40a..9024574e80 100644
&GUID_WICPixelFormat128bppRGBAFloat,
NULL
};
@@ -2026,6 +2028,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
@@ -2024,6 +2026,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
WICPixelFormatNumericRepresentationUnsignedInteger,
0
},
@ -42,11 +42,11 @@ index f695d3e40a..9024574e80 100644
"The Wine Project",
"128bpp RGBAFloat",
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 151b999a35..414c92195e 100644
index 7d7c620..090db31 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -507,8 +507,31 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
return E_FAIL;
return E_NOTIMPL;
}
break;
+
@ -79,10 +79,10 @@ index 151b999a35..414c92195e 100644
case 8: /* CIELab */
default:
diff --git a/include/wincodec.idl b/include/wincodec.idl
index 0e279f590e..3132bf6b3b 100644
index c283301..29e0968 100644
--- a/include/wincodec.idl
+++ b/include/wincodec.idl
@@ -218,6 +218,7 @@ cpp_quote("DEFINE_GUID(GUID_WICPixelFormat64bppPRGBA, 0x6fddc324,0x4e03,0x4bfe,0
@@ -232,6 +232,7 @@ cpp_quote("DEFINE_GUID(GUID_WICPixelFormat64bppPRGBA, 0x6fddc324,0x4e03,0x4bfe,0
cpp_quote("DEFINE_GUID(GUID_WICPixelFormat128bppRGBAFloat, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x19);")
cpp_quote("DEFINE_GUID(GUID_WICPixelFormat32bppCMYK, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x1c);")
@ -91,5 +91,5 @@ index 0e279f590e..3132bf6b3b 100644
cpp_quote("#if 0")
typedef DWORD *D2D1_PIXEL_FORMAT;
--
2.13.1
1.9.1