mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Rebase against 79ebd3f3bf9e5b6607363667d03def04e254f710.
This commit is contained in:
parent
e53b4e2702
commit
6b9d11ac58
@ -1,97 +0,0 @@
|
||||
From eff83781e6c1be78d1614810902b2b0f38f6045e Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Fri, 3 Jun 2016 13:20:14 +0800
|
||||
Subject: gdiplus/tests: Add a test for loading PNG grayscale images.
|
||||
|
||||
---
|
||||
dlls/gdiplus/tests/image.c | 60 +++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 59 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
|
||||
index 6abd026..3d123ad 100644
|
||||
--- a/dlls/gdiplus/tests/image.c
|
||||
+++ b/dlls/gdiplus/tests/image.c
|
||||
@@ -2,7 +2,7 @@
|
||||
* Unit test suite for images
|
||||
*
|
||||
* Copyright (C) 2007 Google (Evan Stade)
|
||||
- * Copyright (C) 2012 Dmitry Timoshkov
|
||||
+ * Copyright (C) 2012,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
|
||||
@@ -4941,6 +4941,63 @@ static void test_imageabort(void)
|
||||
GdipDisposeImage((GpImage*)bm);
|
||||
}
|
||||
|
||||
+/* RGB 24 bpp 1x1 pixel PNG image */
|
||||
+static const char png_1x1_data[] = {
|
||||
+ 0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,
|
||||
+ 0x00,0x00,0x00,0x0d,'I','H','D','R',0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53,0xde,
|
||||
+ 0x00,0x00,0x00,0x0c,'I','D','A','T',0x08,0xd7,0x63,0xf8,0xff,0xff,0x3f,0x00,0x05,0xfe,0x02,0xfe,0xdc,0xcc,0x59,0xe7,
|
||||
+ 0x00,0x00,0x00,0x00,'I','E','N','D',0xae,0x42,0x60,0x82
|
||||
+};
|
||||
+
|
||||
+static void test_png_color_formats(void)
|
||||
+{
|
||||
+ static const struct
|
||||
+ {
|
||||
+ char bit_depth, color_type;
|
||||
+ PixelFormat format;
|
||||
+ } td[] =
|
||||
+ {
|
||||
+ /* 2 - PNG_COLOR_TYPE_RGB */
|
||||
+ { 8, 2, PixelFormat24bppRGB },
|
||||
+ /* 0 - PNG_COLOR_TYPE_GRAY */
|
||||
+ { 1, 0, PixelFormat1bppIndexed },
|
||||
+ { 2, 0, PixelFormat32bppARGB },
|
||||
+ { 4, 0, PixelFormat32bppARGB },
|
||||
+ { 8, 0, PixelFormat32bppARGB },
|
||||
+ { 16, 0, PixelFormat32bppARGB },
|
||||
+ };
|
||||
+ BYTE buf[sizeof(png_1x1_data)];
|
||||
+ GpStatus status;
|
||||
+ GpImage *image;
|
||||
+ ImageType type;
|
||||
+ PixelFormat format;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
|
||||
+ {
|
||||
+ memcpy(buf, png_1x1_data, sizeof(png_1x1_data));
|
||||
+ buf[24] = td[i].bit_depth;
|
||||
+ buf[25] = td[i].color_type;
|
||||
+
|
||||
+ image = load_image(buf, sizeof(buf));
|
||||
+ ok(image != NULL, "%d: failed to load image data\n", i);
|
||||
+ if (!image) continue;
|
||||
+
|
||||
+ status = GdipGetImageType(image, &type);
|
||||
+ ok(status == Ok, "%u: GdipGetImageType error %d\n", i, status);
|
||||
+ ok(type == ImageTypeBitmap, "%d: wrong image type %d\n", i, type);
|
||||
+
|
||||
+ 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);
|
||||
+
|
||||
+ GdipDisposeImage(image);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
START_TEST(image)
|
||||
{
|
||||
HMODULE mod = GetModuleHandleA("gdiplus.dll");
|
||||
@@ -4958,6 +5015,7 @@ START_TEST(image)
|
||||
pGdipBitmapGetHistogram = (void*)GetProcAddress(mod, "GdipBitmapGetHistogram");
|
||||
pGdipImageSetAbort = (void*)GetProcAddress(mod, "GdipImageSetAbort");
|
||||
|
||||
+ test_png_color_formats();
|
||||
test_supported_encoders();
|
||||
test_CloneBitmapArea();
|
||||
test_ARGB_conversion();
|
||||
--
|
||||
2.9.0
|
||||
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "67f6eb327ef78fe8acf45bf6ac6c93424ec89335"
|
||||
echo "79ebd3f3bf9e5b6607363667d03def04e254f710"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -4974,12 +4974,10 @@ fi
|
||||
# | * dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c
|
||||
# |
|
||||
if test "$enable_gdiplus_Grayscale_PNG" -eq 1; then
|
||||
patch_apply gdiplus-Grayscale_PNG/0002-gdiplus-tests-Add-a-test-for-loading-PNG-grayscale-i.patch
|
||||
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/tests: Add a test for loading PNG grayscale images.", 1 },';
|
||||
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 },';
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 22e7223f23016a0c1cffeb58158c59ec82273e51 Mon Sep 17 00:00:00 2001
|
||||
From ed7888a251aef87d82b931a02edc26c9899a236c Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Tue, 20 Sep 2016 14:28:49 +0800
|
||||
Subject: windowscodecs: Add support for palette image formats to PNG encoder.
|
||||
@ -9,7 +9,7 @@ Subject: windowscodecs: Add support for palette image formats to PNG encoder.
|
||||
2 files changed, 49 insertions(+)
|
||||
|
||||
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
|
||||
index 4473b98..d8b4e2f 100644
|
||||
index 10c96038630..3df2c426a46 100644
|
||||
--- a/dlls/windowscodecs/pngformat.c
|
||||
+++ b/dlls/windowscodecs/pngformat.c
|
||||
@@ -1,5 +1,6 @@
|
||||
@ -19,7 +19,7 @@ index 4473b98..d8b4e2f 100644
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -326,8 +327,10 @@ MAKE_FUNCPTR(png_set_gray_to_rgb);
|
||||
@@ -325,8 +326,10 @@ MAKE_FUNCPTR(png_set_gray_to_rgb);
|
||||
MAKE_FUNCPTR(png_set_interlace_handling);
|
||||
MAKE_FUNCPTR(png_set_IHDR);
|
||||
MAKE_FUNCPTR(png_set_pHYs);
|
||||
@ -30,7 +30,7 @@ index 4473b98..d8b4e2f 100644
|
||||
MAKE_FUNCPTR(png_set_tRNS_to_alpha);
|
||||
MAKE_FUNCPTR(png_set_write_fn);
|
||||
MAKE_FUNCPTR(png_read_end);
|
||||
@@ -386,8 +389,10 @@ static void *load_libpng(void)
|
||||
@@ -389,8 +392,10 @@ static void *load_libpng(void)
|
||||
LOAD_FUNCPTR(png_set_interlace_handling);
|
||||
LOAD_FUNCPTR(png_set_IHDR);
|
||||
LOAD_FUNCPTR(png_set_pHYs);
|
||||
@ -41,8 +41,8 @@ index 4473b98..d8b4e2f 100644
|
||||
LOAD_FUNCPTR(png_set_tRNS_to_alpha);
|
||||
LOAD_FUNCPTR(png_set_write_fn);
|
||||
LOAD_FUNCPTR(png_read_end);
|
||||
@@ -1313,6 +1318,10 @@ static const struct png_pixelformat formats[] = {
|
||||
{&GUID_WICPixelFormat32bppBGRA, 32, 8, PNG_COLOR_TYPE_RGB_ALPHA, 0, 1},
|
||||
@@ -1315,6 +1320,10 @@ static const struct png_pixelformat formats[] = {
|
||||
{&GUID_WICPixelFormat32bppBGR, 32, 8, PNG_COLOR_TYPE_RGB, 1, 1},
|
||||
{&GUID_WICPixelFormat48bppRGB, 48, 16, PNG_COLOR_TYPE_RGB, 0, 0},
|
||||
{&GUID_WICPixelFormat64bppRGBA, 64, 16, PNG_COLOR_TYPE_RGB_ALPHA, 0, 0},
|
||||
+ {&GUID_WICPixelFormat1bppIndexed, 1, 1, PNG_COLOR_TYPE_PALETTE, 0, 0},
|
||||
@ -52,7 +52,7 @@ index 4473b98..d8b4e2f 100644
|
||||
{NULL},
|
||||
};
|
||||
|
||||
@@ -1600,6 +1609,42 @@ static HRESULT WINAPI PngFrameEncode_WritePixels(IWICBitmapFrameEncode *iface,
|
||||
@@ -1617,6 +1626,42 @@ static HRESULT WINAPI PngFrameEncode_WritePixels(IWICBitmapFrameEncode *iface,
|
||||
(This->yres+0.0127) / 0.0254, PNG_RESOLUTION_METER);
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ index 4473b98..d8b4e2f 100644
|
||||
|
||||
if (This->format->remove_filler)
|
||||
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
|
||||
index 10a6c03..b011d71 100644
|
||||
index 10a6c03d9b6..b011d716451 100644
|
||||
--- a/dlls/windowscodecs/regsvr.c
|
||||
+++ b/dlls/windowscodecs/regsvr.c
|
||||
@@ -1359,6 +1359,10 @@ static GUID const * const png_encode_formats[] = {
|
||||
@ -111,5 +111,5 @@ index 10a6c03..b011d71 100644
|
||||
};
|
||||
|
||||
--
|
||||
2.9.0
|
||||
2.14.1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user