2018-12-07 17:39:19 -08:00
|
|
|
From ff6282f297e67822ee0def394a677a4fdc0fa609 Mon Sep 17 00:00:00 2001
|
2017-02-02 13:48:15 -08:00
|
|
|
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
|
|
|
Date: Thu, 26 Jan 2017 19:01:21 +0800
|
2018-12-07 17:39:19 -08:00
|
|
|
Subject: windowscodecs: Fix 32bppRGB to 32bppRGBA conversion.
|
2017-02-02 13:48:15 -08:00
|
|
|
|
|
|
|
---
|
|
|
|
dlls/windowscodecs/converter.c | 2 ++
|
2018-12-07 17:39:19 -08:00
|
|
|
dlls/windowscodecs/tests/converter.c | 45 +++++++++++++++++++++++++++++++++++-
|
|
|
|
2 files changed, 46 insertions(+), 1 deletion(-)
|
2017-02-02 13:48:15 -08:00
|
|
|
|
|
|
|
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
|
2018-12-07 17:39:19 -08:00
|
|
|
index 519860d9065..1378c85bc2d 100644
|
2017-02-02 13:48:15 -08:00
|
|
|
--- a/dlls/windowscodecs/converter.c
|
|
|
|
+++ b/dlls/windowscodecs/converter.c
|
|
|
|
@@ -868,7 +868,9 @@ static HRESULT copypixels_to_32bppRGBA(struct FormatConverter *This, const WICRe
|
|
|
|
|
|
|
|
switch (source_format)
|
|
|
|
{
|
|
|
|
+ case format_32bppRGB:
|
|
|
|
case format_32bppRGBA:
|
|
|
|
+ case format_32bppPRGBA:
|
|
|
|
if (prc)
|
|
|
|
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
|
2018-12-07 17:39:19 -08:00
|
|
|
index 1cafe90c734..17724d9ed01 100644
|
2017-02-02 13:48:15 -08:00
|
|
|
--- a/dlls/windowscodecs/tests/converter.c
|
|
|
|
+++ b/dlls/windowscodecs/tests/converter.c
|
2018-12-07 17:39:19 -08:00
|
|
|
@@ -291,6 +291,21 @@ static BOOL compare_bits(const struct bitmap_data *expect, UINT buffersize, cons
|
2017-02-02 13:48:15 -08:00
|
|
|
if (!equal && expect->alt_data)
|
|
|
|
equal = compare_bits(expect->alt_data, buffersize, converted_bits);
|
|
|
|
|
|
|
|
+ if (!equal && winetest_debug > 1)
|
|
|
|
+ {
|
|
|
|
+ UINT i, bps;
|
|
|
|
+ bps = expect->bpp / 8;
|
|
|
|
+ if (!bps) bps = buffersize;
|
|
|
|
+ printf("converted_bits (%u bytes):\n ", buffersize);
|
|
|
|
+ for (i = 0; i < buffersize; i++)
|
|
|
|
+ {
|
|
|
|
+ printf("%u,", converted_bits[i]);
|
|
|
|
+ if (!((i + 1) % 32)) printf("\n ");
|
|
|
|
+ else if (!((i+1) % bps)) printf(" ");
|
|
|
|
+ }
|
|
|
|
+ printf("\n");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return equal;
|
|
|
|
}
|
|
|
|
|
2018-12-07 17:39:19 -08:00
|
|
|
@@ -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};
|
2017-02-02 13:48:15 -08:00
|
|
|
static const struct bitmap_data testdata_32bppBGR = {
|
2018-12-07 17:39:19 -08:00
|
|
|
&GUID_WICPixelFormat32bppBGR, 32, bits_32bppBGR, 32, 2, 96.0, 96.0};
|
2017-02-02 13:48:15 -08:00
|
|
|
+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[] = {
|
2018-12-07 17:39:19 -08:00
|
|
|
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};
|
2017-02-02 13:48:15 -08:00
|
|
|
static const struct bitmap_data testdata_32bppBGRA = {
|
2018-12-07 17:39:19 -08:00
|
|
|
&GUID_WICPixelFormat32bppBGRA, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0};
|
2017-02-02 13:48:15 -08:00
|
|
|
+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 = {
|
|
|
|
+ &GUID_WICPixelFormat32bppRGB, 32, bits_32bppBGRA, 32, 2, 96.0, 96.0};
|
|
|
|
+
|
|
|
|
+static const BYTE bits_32bppPBGRA[] = {
|
|
|
|
+ 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
|
|
|
|
+ 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
|
|
|
|
+ 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
|
|
|
|
+ 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80, 80,0,0,80, 0,80,0,80, 0,0,80,80, 0,0,0,80,
|
|
|
|
+ 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80,
|
|
|
|
+ 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80,
|
|
|
|
+ 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80,
|
|
|
|
+ 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80, 0,80,80,80, 80,0,80,80, 80,80,0,80, 80,80,80,80};
|
|
|
|
+static const struct bitmap_data testdata_32bppPBGRA = {
|
|
|
|
+ &GUID_WICPixelFormat32bppPBGRA, 32, bits_32bppPBGRA, 32, 2, 96.0, 96.0};
|
|
|
|
+static const struct bitmap_data testdata_32bppPRGBA = {
|
|
|
|
+ &GUID_WICPixelFormat32bppPRGBA, 32, bits_32bppPBGRA, 32, 2, 96.0, 96.0};
|
|
|
|
|
|
|
|
/* XP and 2003 use linear color conversion, later versions use sRGB gamma */
|
|
|
|
static const float bits_32bppGrayFloat_xp[] = {
|
2018-12-07 17:39:19 -08:00
|
|
|
@@ -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)
|
2017-02-02 13:48:15 -08:00
|
|
|
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);
|
|
|
|
+ test_conversion(&testdata_32bppBGRA80, &testdata_32bppPBGRA, "BGRA -> PBGRA", FALSE);
|
|
|
|
+
|
|
|
|
+ test_conversion(&testdata_32bppRGBA, &testdata_32bppRGB, "RGBA -> RGB", FALSE);
|
|
|
|
+ test_conversion(&testdata_32bppRGB, &testdata_32bppRGBA, "RGB -> RGBA", FALSE);
|
|
|
|
+ test_conversion(&testdata_32bppRGBA, &testdata_32bppRGBA, "RGBA -> RGBA", FALSE);
|
|
|
|
+ test_conversion(&testdata_32bppRGBA80, &testdata_32bppPRGBA, "RGBA -> PRGBA", FALSE);
|
|
|
|
|
|
|
|
test_conversion(&testdata_24bppBGR, &testdata_24bppBGR, "24bppBGR -> 24bppBGR", FALSE);
|
|
|
|
test_conversion(&testdata_24bppBGR, &testdata_24bppRGB, "24bppBGR -> 24bppRGB", FALSE);
|
|
|
|
--
|
2018-12-07 17:39:19 -08:00
|
|
|
2.11.0
|
2017-02-02 13:48:15 -08:00
|
|
|
|