Rebase against 6b76648a8b773838ecde00719ca54a433edf5ce6

This commit is contained in:
Alistair Leslie-Hughes 2019-02-06 14:27:30 +11:00
parent 1edb7d5bc5
commit 3dab9e5e6b
7 changed files with 11 additions and 893 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "152cda38df79cf04aae589f1d721de3cac1cd49e"
echo "6b76648a8b773838ecde00719ca54a433edf5ce6"
}
# Show version information
@ -2568,7 +2568,7 @@ fi
# |
# | Modified files:
# | * dlls/bcrypt/bcrypt.spec, dlls/bcrypt/bcrypt_internal.h, dlls/bcrypt/bcrypt_main.c, dlls/bcrypt/gnutls.c,
# | dlls/bcrypt/tests/bcrypt.c, dlls/ncrypt/ncrypt.spec, include/bcrypt.h
# | dlls/bcrypt/macos.c, dlls/bcrypt/tests/bcrypt.c, dlls/ncrypt/ncrypt.spec, include/bcrypt.h
# |
if test "$enable_bcrypt_BCryptGenerateKeyPair" -eq 1; then
patch_apply bcrypt-BCryptGenerateKeyPair/0001-bcrypt-Implement-BCryptGenerate-FinalizeKeyPair-for-.patch
@ -6862,38 +6862,27 @@ fi
# Patchset windowscodecs-GIF_Encoder
# |
# | Modified files:
# | * dlls/gdiplus/tests/image.c, dlls/windowscodecs/clsfactory.c, dlls/windowscodecs/converter.c,
# | dlls/windowscodecs/gifformat.c, dlls/windowscodecs/info.c, dlls/windowscodecs/regsvr.c,
# | dlls/windowscodecs/tests/converter.c, dlls/windowscodecs/wincodecs_private.h,
# | * dlls/gdiplus/tests/image.c, dlls/windowscodecs/clsfactory.c, dlls/windowscodecs/gifformat.c,
# | dlls/windowscodecs/regsvr.c, dlls/windowscodecs/tests/converter.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/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
patch_apply windowscodecs-GIF_Encoder/0016-windowscodecs-WICConvertBitmapSource-should-ask-IWIC.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' '+ { "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 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "windowscodecs: WICConvertBitmapSource should ask IWICFormatConverter::Initialize to use an optimized palette.", 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

View File

@ -1,4 +1,4 @@
From b396392de5b090fb78a358dec7a8790ecedf2240 Mon Sep 17 00:00:00 2001
From dd19f26a49f288dec1d287ebaaeb7a2dd2e7f0cd Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 15 Oct 2018 12:05:41 +1100
Subject: [PATCH] setupapi: Add SetupDiInstallDeviceInterfaces
@ -11,12 +11,12 @@ Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
2 files changed, 13 insertions(+)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 771fc70..b15e580 100644
index 632d704c9bd..129b7384162 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4020,3 +4020,15 @@ BOOL WINAPI SetupDiGetDevicePropertyW(HDEVINFO info_set, PSP_DEVINFO_DATA info_d
SetLastError(ERROR_NOT_FOUND);
return FALSE;
@@ -4002,3 +4002,15 @@ BOOL WINAPI SetupDiGetDevicePropertyW(HDEVINFO devinfo, PSP_DEVINFO_DATA device_
SetLastError(ls);
return !ls;
}
+
+/***********************************************************************
@ -31,7 +31,7 @@ index 771fc70..b15e580 100644
+}
+
diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec
index 99509e1..3f906ed 100644
index 3cd5663a01e..984f2218f02 100644
--- a/dlls/setupapi/setupapi.spec
+++ b/dlls/setupapi/setupapi.spec
@@ -367,6 +367,7 @@
@ -43,5 +43,5 @@ index 99509e1..3f906ed 100644
@ stdcall SetupDiLoadClassIcon(ptr ptr ptr)
@ stub SetupDiMoveDuplicateDevice
--
1.9.1
2.20.1

View File

@ -1,28 +0,0 @@
From 8d2a6325a891a2fab8bf7c091cb8fb73468ae1ea Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 20 Oct 2016 16:57:51 +0800
Subject: windowscodecs: WICConvertBitmapSource should ask
IWICFormatConverter::Initialize to use an optimized palette.
This matches Windows' behaviour, and makes a simple test application that converts
any WIC compatible RGB(A) source image to 8bppIndexed format (GIF for instance) work.
---
dlls/windowscodecs/info.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c
index 1a93491..c1e8a66 100644
--- a/dlls/windowscodecs/info.c
+++ b/dlls/windowscodecs/info.c
@@ -2336,7 +2336,7 @@ HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitma
if (SUCCEEDED(res) && canconvert)
res = IWICFormatConverter_Initialize(converter, pISrc, dstFormat, WICBitmapDitherTypeNone,
- NULL, 0.0, WICBitmapPaletteTypeCustom);
+ NULL, 0.0, WICBitmapPaletteTypeMedianCut);
if (FAILED(res) || !canconvert)
{
--
2.9.0

View File

@ -1,100 +0,0 @@
From 9ddafc9d2cd0fc899e513807a34ef4e875851fca Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 27 Oct 2016 14:55:03 +0800
Subject: windowscodecs: Fix behaviour of format converter for indexed formats
when NULL or empty palette has been provided.
---
dlls/windowscodecs/converter.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index c6a2514..4ee980e 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -1240,7 +1240,6 @@ static HRESULT copypixels_to_8bppIndexed(struct FormatConverter *This, const WIC
hr = IWICPalette_GetColors(This->palette, 256, colors, &count);
if (hr != S_OK) return hr;
- if (!count) return WINCODEC_ERR_WRONGSTATE;
srcstride = 3 * prc->Width;
srcdatasize = srcstride * prc->Height;
@@ -1409,7 +1408,18 @@ static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface,
TRACE("(%p,%p)\n", iface, palette);
if (!palette) return E_INVALIDARG;
- if (!This->palette) return WINCODEC_ERR_WRONGSTATE;
+ if (!This->source) return WINCODEC_ERR_WRONGSTATE;
+
+ if (!This->palette)
+ {
+ HRESULT hr;
+ UINT bpp;
+
+ hr = get_pixelformat_bpp(This->dst_format->guid, &bpp);
+ if (hr != S_OK) return hr;
+ if (bpp <= 8) return WINCODEC_ERR_WRONGSTATE;
+ return IWICBitmapSource_CopyPalette(This->source, palette);
+ }
return IWICPalette_InitializeFromPalette(palette, This->palette);
}
@@ -1440,7 +1450,7 @@ static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface,
pbBuffer, This->src_format->format);
}
else
- return WINCODEC_ERR_NOTINITIALIZED;
+ return WINCODEC_ERR_WRONGSTATE;
}
static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
@@ -1457,6 +1467,10 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
if (!palette)
{
+ UINT bpp;
+ res = get_pixelformat_bpp(dstFormat, &bpp);
+ if (res != S_OK) return res;
+
res = PaletteImpl_Create(&palette);
if (res != S_OK) return res;
@@ -1465,20 +1479,19 @@ static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface,
case WICBitmapPaletteTypeCustom:
IWICPalette_Release(palette);
palette = NULL;
- res = S_OK;
+ if (bpp <= 8) return E_INVALIDARG;
break;
case WICBitmapPaletteTypeMedianCut:
{
- UINT bpp;
- res = get_pixelformat_bpp(dstFormat, &bpp);
- if (res == S_OK && bpp <= 8)
+ if (bpp <= 8)
res = IWICPalette_InitializeFromBitmap(palette, source, 1 << bpp, FALSE);
break;
}
default:
- res = IWICPalette_InitializePredefined(palette, palette_type, FALSE);
+ if (bpp <= 8)
+ res = IWICPalette_InitializePredefined(palette, palette_type, FALSE);
break;
}
@@ -1538,6 +1551,9 @@ end:
LeaveCriticalSection(&This->lock);
+ if (res != S_OK && palette)
+ IWICPalette_Release(palette);
+
return res;
}
--
2.9.0

View File

@ -1,529 +0,0 @@
From e80477c69984c1f188de779fbf7559dd17d61416 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 27 Oct 2016 15:10:09 +0800
Subject: [PATCH] windowscodecs/tests: Add a bunch of new tests for indexed
format conversions.
---
dlls/windowscodecs/tests/converter.c | 269 ++++++++++++++++++++-------
1 file changed, 201 insertions(+), 68 deletions(-)
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index 4eea13b8..925d97ea 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -118,9 +118,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,
@@ -252,6 +273,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);
@@ -261,7 +297,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;
@@ -294,15 +342,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);
}
@@ -318,78 +375,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)
{
@@ -401,11 +517,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);
}
@@ -453,7 +570,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);
}
@@ -752,7 +869,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);
@@ -762,7 +879,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);
@@ -772,7 +889,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);
@@ -790,7 +907,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);
@@ -798,13 +914,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);
@@ -816,9 +931,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);
@@ -828,9 +943,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);
@@ -840,9 +955,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);
@@ -910,7 +1025,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);
@@ -921,7 +1036,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);
@@ -932,7 +1047,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);
@@ -943,7 +1058,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);
@@ -1250,7 +1365,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))
@@ -1285,7 +1401,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)
@@ -1333,8 +1451,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);
@@ -1345,7 +1463,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_WICPixelFormat4bppIndexed))
+ else if (IsEqualGUID(&pixelformat, &GUID_WICPixelFormat4bppIndexed))
{
ok(count == 16, "expected 16, got %u (%s)\n", count, name);
@@ -1435,7 +1553,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);
@@ -1446,7 +1564,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);
@@ -1478,6 +1596,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);
@@ -1515,6 +1643,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.19.1

View File

@ -1,189 +0,0 @@
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: [PATCH] windowscodecs/tests: Add some tests for converting
24bppBGR to 8bppIndexed format.
---
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 4eea13b..089926b 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -1468,6 +1468,163 @@ static const struct setting png_interlace_settings[] = {
{NULL}
};
+static void test_converter_8bppIndexed(void)
+{
+ HRESULT hr;
+ BitmapTestSrc *src_obj;
+ IWICFormatConverter *converter;
+ IWICPalette *palette;
+ UINT count, i;
+ BYTE buf[32 * 2 * 3]; /* enough to hold 32x2 24bppBGR data */
+
+ CreateTestBitmap(&testdata_24bppBGR, &src_obj);
+
+ hr = IWICImagingFactory_CreatePalette(factory, &palette);
+ ok(hr == S_OK, "CreatePalette error %#x\n", hr);
+ count = 0xdeadbeef;
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 0, "expected 0, got %u\n", count);
+
+ /* NULL palette + Custom type*/
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
+ &GUID_WICPixelFormat24bppBGR, WICBitmapDitherTypeNone,
+ NULL, 0.0, WICBitmapPaletteTypeCustom);
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
+ ok(hr == 0xdeadbeef, "unexpected error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32 * 3, sizeof(buf), buf);
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
+ IWICFormatConverter_Release(converter);
+
+ /* NULL palette + Custom type*/
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
+ NULL, 0.0, WICBitmapPaletteTypeCustom);
+ ok(hr == E_INVALIDARG, "unexpected error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
+ ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
+ ok(hr == WINCODEC_ERR_WRONGSTATE, "unexpected error %#x\n", hr);
+ IWICFormatConverter_Release(converter);
+
+ /* empty palette + Custom type*/
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
+ palette, 0.0, WICBitmapPaletteTypeCustom);
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+ count = 0xdeadbeef;
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 0, "expected 0, got %u\n", count);
+ memset(buf, 0xaa, sizeof(buf));
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
+ count = 0;
+ for (i = 0; i < 32 * 2; i++)
+ if (buf[i] != 0) count++;
+ ok(count == 0, "expected 0\n");
+ IWICFormatConverter_Release(converter);
+
+ /* NULL palette + Predefined type*/
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
+ NULL, 0.0, WICBitmapPaletteTypeFixedGray16);
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+ count = 0xdeadbeef;
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 16, "expected 16, got %u\n", count);
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
+ count = 0;
+ for (i = 0; i < 32 * 2; i++)
+ if (buf[i] != 0) count++;
+ ok(count != 0, "expected != 0\n");
+ IWICFormatConverter_Release(converter);
+
+ /* not empty palette + Predefined type*/
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
+ palette, 0.0, WICBitmapPaletteTypeFixedHalftone64);
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+ count = 0xdeadbeef;
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 16, "expected 16, got %u\n", count);
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
+ count = 0;
+ for (i = 0; i < 32 * 2; i++)
+ if (buf[i] != 0) count++;
+ ok(count != 0, "expected != 0\n");
+ IWICFormatConverter_Release(converter);
+
+ /* not empty palette + MedianCut type*/
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
+ palette, 0.0, WICBitmapPaletteTypeMedianCut);
+ ok(hr == S_OK, "Initialize error %#x\n", hr);
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+ count = 0xdeadbeef;
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 16, "expected 16, got %u\n", count);
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
+ count = 0;
+ for (i = 0; i < 32 * 2; i++)
+ if (buf[i] != 0) count++;
+ ok(count != 0, "expected != 0\n");
+ IWICFormatConverter_Release(converter);
+
+ /* NULL palette + MedianCut type*/
+ hr = IWICImagingFactory_CreateFormatConverter(factory, &converter);
+ ok(hr == S_OK, "CreateFormatConverter error %#x\n", hr);
+ hr = IWICFormatConverter_Initialize(converter, &src_obj->IWICBitmapSource_iface,
+ &GUID_WICPixelFormat8bppIndexed, WICBitmapDitherTypeNone,
+ NULL, 0.0, WICBitmapPaletteTypeMedianCut);
+ ok(hr == S_OK || broken(hr == E_INVALIDARG) /* XP */, "Initialize error %#x\n", hr);
+ if (hr == S_OK)
+ {
+ hr = IWICFormatConverter_CopyPalette(converter, palette);
+ ok(hr == S_OK, "CopyPalette error %#x\n", hr);
+ count = 0xdeadbeef;
+ hr = IWICPalette_GetColorCount(palette, &count);
+ ok(hr == S_OK, "GetColorCount error %#x\n", hr);
+ ok(count == 8, "expected 8, got %u\n", count);
+ hr = IWICFormatConverter_CopyPixels(converter, NULL, 32, sizeof(buf), buf);
+ ok(hr == S_OK, "CopyPixels error %#x\n", hr);
+ count = 0;
+ for (i = 0; i < 32 * 2; i++)
+ if (buf[i] != 0) count++;
+ ok(count != 0, "expected != 0\n");
+ }
+ IWICFormatConverter_Release(converter);
+
+ IWICPalette_Release(palette);
+ DeleteTestBitmap(src_obj);
+}
+
START_TEST(converter)
{
HRESULT hr;
@@ -1502,6 +1659,7 @@ START_TEST(converter)
test_invalid_conversion();
test_default_converter();
+ test_converter_8bppIndexed();
test_encoder(&testdata_BlackWhite, &CLSID_WICPngEncoder,
&testdata_BlackWhite, &CLSID_WICPngDecoder, "PNG encoder BlackWhite");
--
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