Rebase against 083e61fddf90ade32a119d5b6bf84d27adefc589.

This commit is contained in:
Sebastian Lackner 2017-08-26 01:02:52 +02:00
parent 41562729cd
commit 00540ae7b9
2 changed files with 1 additions and 72 deletions

View File

@ -1,69 +0,0 @@
From c833d4e659d164dd69842d0c4deb39427a600fab Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 3 Jun 2016 13:47:06 +0800
Subject: gdiplus: Force conversion of 8 bpp grayscale PNG images to 32 bpp
BGRA.
---
dlls/gdiplus/image.c | 32 +++++++++++++++++++++++++++++++-
dlls/gdiplus/tests/image.c | 1 -
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index d1a5593..a8d8f2d 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -3951,7 +3951,37 @@ static GpStatus decode_image_jpeg(IStream* stream, GpImage **image)
static GpStatus decode_image_png(IStream* stream, GpImage **image)
{
- return decode_image_wic(stream, &GUID_ContainerFormatPng, png_metadata_reader, image);
+ IWICBitmapDecoder *decoder;
+ IWICBitmapFrameDecode *frame;
+ GpStatus status;
+ HRESULT hr;
+ GUID format;
+ BOOL force_conversion = FALSE;
+
+ status = initialize_decoder_wic(stream, &GUID_ContainerFormatPng, &decoder);
+ if (status != Ok)
+ return status;
+
+ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
+ if (hr == S_OK)
+ {
+ hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &format);
+ if (hr == S_OK)
+ {
+ if (IsEqualGUID(&format, &GUID_WICPixelFormat8bppGray))
+ force_conversion = TRUE;
+ status = decode_frame_wic(decoder, force_conversion, 0, png_metadata_reader, image);
+ }
+ else
+ status = hresult_to_status(hr);
+
+ IWICBitmapFrameDecode_Release(frame);
+ }
+ else
+ status = hresult_to_status(hr);
+
+ IWICBitmapDecoder_Release(decoder);
+ return status;
}
static GpStatus decode_image_gif(IStream* stream, GpImage **image)
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 0c28c9e..b4682f7 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -4773,7 +4773,6 @@ static void test_png_color_formats(void)
status = GdipGetImagePixelFormat(image, &format);
expect(Ok, status);
-todo_wine_if(td[i].bit_depth == 8 && td[i].color_type == 0)
ok(format == td[i].format ||
broken(td[i].bit_depth == 1 && td[i].color_type == 0 && format == PixelFormat32bppARGB), /* XP */
"%d: expected %#x, got %#x\n", i, td[i].format, format);
--
2.8.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "cc49c40f05a600327b80711f6f80844608dde366"
echo "083e61fddf90ade32a119d5b6bf84d27adefc589"
}
# Show version information
@ -4970,11 +4970,9 @@ fi
# | * dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c
# |
if test "$enable_gdiplus_Grayscale_PNG" -eq 1; then
patch_apply gdiplus-Grayscale_PNG/0003-gdiplus-Force-conversion-of-8-bpp-grayscale-PNG-imag.patch
patch_apply gdiplus-Grayscale_PNG/0004-gdiplus-tests-Add-a-test-for-image-flags-to-PNG-gray.patch
patch_apply gdiplus-Grayscale_PNG/0005-gdiplus-Set-correct-color-space-flags-for-grayscale-.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "gdiplus: Force conversion of 8 bpp grayscale PNG images to 32 bpp BGRA.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "gdiplus/tests: Add a test for image flags to PNG grayscale image tests.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "gdiplus: Set correct color space flags for grayscale images.", 1 },';
) >> "$patchlist"