diff --git a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0001-gdiplus-GdipCreateBitmapFromHBITMAP-should-use-palet.patch b/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0001-gdiplus-GdipCreateBitmapFromHBITMAP-should-use-palet.patch deleted file mode 100644 index e991bbde..00000000 --- a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0001-gdiplus-GdipCreateBitmapFromHBITMAP-should-use-palet.patch +++ /dev/null @@ -1,76 +0,0 @@ -From fdde823d2213a71de08a7d96827b6657b7d8bfd8 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Thu, 19 Dec 2019 12:49:07 +0800 -Subject: [PATCH 1/3] gdiplus: GdipCreateBitmapFromHBITMAP should use palette - from the GDI bitmap. - -This patch fixes painting bitmaps with bpp <= 8. - -Signed-off-by: Dmitry Timoshkov ---- - dlls/gdiplus/image.c | 21 ++++++++++----------- - 1 file changed, 10 insertions(+), 11 deletions(-) - -diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c -index c3e538d6dba..aed931dd7df 100644 ---- a/dlls/gdiplus/image.c -+++ b/dlls/gdiplus/image.c -@@ -5111,6 +5111,8 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi - GpStatus retval; - PixelFormat format; - BitmapData lockeddata; -+ char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; -+ BITMAPINFO *pbmi = (BITMAPINFO *)bmibuf; - - TRACE("%p %p %p\n", hbm, hpal, bitmap); - -@@ -5160,8 +5162,6 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi - if (retval == Ok) - { - HDC hdc; -- char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; -- BITMAPINFO *pbmi = (BITMAPINFO *)bmibuf; - INT src_height; - - hdc = CreateCompatibleDC(NULL); -@@ -5181,29 +5181,28 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi - GdipBitmapUnlockBits(*bitmap, &lockeddata); - } - -- if (retval == Ok && hpal) -+ /* According to the tests hpal is ignored */ -+ if (retval == Ok && pbmi->bmiHeader.biBitCount <= 8) - { -- PALETTEENTRY entry[256]; -- ColorPalette *palette=NULL; -+ ColorPalette *palette; - int i, num_palette_entries; - -- num_palette_entries = GetPaletteEntries(hpal, 0, 256, entry); -+ num_palette_entries = pbmi->bmiHeader.biClrUsed; - if (!num_palette_entries) -- retval = GenericError; -+ num_palette_entries = 1 << pbmi->bmiHeader.biBitCount; - - palette = heap_alloc_zero(sizeof(ColorPalette) + sizeof(ARGB) * (num_palette_entries-1)); - if (!palette) - retval = OutOfMemory; -- -- if (retval == Ok) -+ else - { - palette->Flags = 0; - palette->Count = num_palette_entries; - - for (i=0; iEntries[i] = 0xff000000 | entry[i].peRed << 16 | -- entry[i].peGreen << 8 | entry[i].peBlue; -+ palette->Entries[i] = 0xff000000 | pbmi->bmiColors[i].rgbRed << 16 | -+ pbmi->bmiColors[i].rgbGreen << 8 | pbmi->bmiColors[i].rgbBlue; - } - - retval = GdipSetImagePalette(&(*bitmap)->image, palette); --- -2.24.0 - diff --git a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0002-gdiplus-Reimplement-GdipCreateBitmapFromGdiDib-by-us.patch b/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0002-gdiplus-Reimplement-GdipCreateBitmapFromGdiDib-by-us.patch deleted file mode 100644 index 70d6e9d4..00000000 --- a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0002-gdiplus-Reimplement-GdipCreateBitmapFromGdiDib-by-us.patch +++ /dev/null @@ -1,82 +0,0 @@ -From ec412084355740035c309ab3ce82b6bcaf17a1f8 Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Tue, 17 Dec 2019 17:12:55 +0800 -Subject: [PATCH 2/3] gdiplus: Reimplement GdipCreateBitmapFromGdiDib by using - GdipCreateBitmapFromHBITMAP. - -Signed-off-by: Dmitry Timoshkov ---- - dlls/gdiplus/image.c | 47 ++++++++++++-------------------------------- - 1 file changed, 13 insertions(+), 34 deletions(-) - -diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c -index aed931dd7df..76dc9a73f84 100644 ---- a/dlls/gdiplus/image.c -+++ b/dlls/gdiplus/image.c -@@ -1386,50 +1386,29 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* info, - VOID *bits, GpBitmap **bitmap) - { - DWORD height, stride; -- PixelFormat format; -+ HBITMAP hbm; -+ void *bmbits; -+ GpStatus status; - -- FIXME("(%p, %p, %p) - partially implemented\n", info, bits, bitmap); -+ TRACE("(%p, %p, %p)\n", info, bits, bitmap); - - if (!info || !bits || !bitmap) - return InvalidParameter; - -+ hbm = CreateDIBSection(0, info, DIB_RGB_COLORS, &bmbits, NULL, 0); -+ if (!hbm) -+ return InvalidParameter; -+ - height = abs(info->bmiHeader.biHeight); - stride = ((info->bmiHeader.biWidth * info->bmiHeader.biBitCount + 31) >> 3) & ~3; -+ TRACE("height %u, stride %u, image size %u\n", height, stride, height * stride); - -- if(info->bmiHeader.biHeight > 0) /* bottom-up */ -- { -- bits = (BYTE*)bits + (height - 1) * stride; -- stride = -stride; -- } -+ memcpy(bmbits, bits, height * stride); - -- switch(info->bmiHeader.biBitCount) { -- case 1: -- format = PixelFormat1bppIndexed; -- break; -- case 4: -- format = PixelFormat4bppIndexed; -- break; -- case 8: -- format = PixelFormat8bppIndexed; -- break; -- case 16: -- format = PixelFormat16bppRGB555; -- break; -- case 24: -- format = PixelFormat24bppRGB; -- break; -- case 32: -- format = PixelFormat32bppRGB; -- break; -- default: -- FIXME("don't know how to handle %d bpp\n", info->bmiHeader.biBitCount); -- *bitmap = NULL; -- return InvalidParameter; -- } -- -- return GdipCreateBitmapFromScan0(info->bmiHeader.biWidth, height, stride, format, -- bits, bitmap); -+ status = GdipCreateBitmapFromHBITMAP(hbm, NULL, bitmap); -+ DeleteObject(hbm); - -+ return status; - } - - /* FIXME: no icm */ --- -2.24.0 - diff --git a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0003-gdiplus-tests-Add-more-tests-for-GdipCreateBitmapFro.patch b/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0003-gdiplus-tests-Add-more-tests-for-GdipCreateBitmapFro.patch deleted file mode 100644 index 1cc9aa83..00000000 --- a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/0003-gdiplus-tests-Add-more-tests-for-GdipCreateBitmapFro.patch +++ /dev/null @@ -1,171 +0,0 @@ -From e05580420344b0a020b1d3143f277ce5e7f68a4a Mon Sep 17 00:00:00 2001 -From: Dmitry Timoshkov -Date: Fri, 20 Dec 2019 15:35:28 +0800 -Subject: [PATCH 3/3] gdiplus/tests: Add more tests for - GdipCreateBitmapFromHBITMAP and palette images. - -Signed-off-by: Dmitry Timoshkov ---- - dlls/gdiplus/tests/image.c | 88 ++++++++++++++++++++++++++++++++++---- - 1 file changed, 79 insertions(+), 9 deletions(-) - -diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c -index a1b141223fc..80ec2239a5f 100644 ---- a/dlls/gdiplus/tests/image.c -+++ b/dlls/gdiplus/tests/image.c -@@ -866,7 +866,7 @@ static void test_LockBits_UserBuf(void) - struct BITMAPINFOWITHBITFIELDS - { - BITMAPINFOHEADER bmiHeader; -- DWORD masks[3]; -+ DWORD masks[255]; - }; - - union BITMAPINFOUNION -@@ -882,7 +882,10 @@ static void test_GdipCreateBitmapFromHBITMAP(void) - HPALETTE hpal = NULL; - GpStatus stat; - BYTE buff[1000]; -- LOGPALETTE* LogPal = NULL; -+ char logpalette_buf[sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * 255]; -+ LOGPALETTE *LogPal = (LOGPALETTE *)logpalette_buf; -+ char colorpalette_buf[sizeof(ColorPalette) + sizeof(ARGB) * 255]; -+ ColorPalette *palette = (ColorPalette *)colorpalette_buf; - REAL width, height; - const REAL WIDTH1 = 5; - const REAL HEIGHT1 = 15; -@@ -892,6 +895,7 @@ static void test_GdipCreateBitmapFromHBITMAP(void) - union BITMAPINFOUNION bmi; - BYTE *bits; - PixelFormat format; -+ int i; - - stat = GdipCreateBitmapFromHBITMAP(NULL, NULL, NULL); - expect(InvalidParameter, stat); -@@ -905,6 +909,9 @@ static void test_GdipCreateBitmapFromHBITMAP(void) - expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height)); - expectf(WIDTH1, width); - expectf(HEIGHT1, height); -+ stat = GdipGetImagePixelFormat((GpImage*)gpbm, &format); -+ expect(Ok, stat); -+ expect(PixelFormat1bppIndexed, format); - if (stat == Ok) - GdipDisposeImage((GpImage*)gpbm); - DeleteObject(hbm); -@@ -916,6 +923,10 @@ static void test_GdipCreateBitmapFromHBITMAP(void) - /* raw format */ - expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)gpbm, __LINE__, FALSE); - -+ stat = GdipGetImagePixelFormat((GpImage*)gpbm, &format); -+ expect(Ok, stat); -+ expect(PixelFormat1bppIndexed, format); -+ - expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height)); - expectf(WIDTH2, width); - expectf(HEIGHT2, height); -@@ -943,6 +954,9 @@ static void test_GdipCreateBitmapFromHBITMAP(void) - expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height)); - expectf(WIDTH1, width); - expectf(HEIGHT1, height); -+ stat = GdipGetImagePixelFormat((GpImage*)gpbm, &format); -+ expect(Ok, stat); -+ expect(PixelFormat24bppRGB, format); - if (stat == Ok) - { - /* test whether writing to the bitmap affects the original */ -@@ -954,21 +968,77 @@ static void test_GdipCreateBitmapFromHBITMAP(void) - GdipDisposeImage((GpImage*)gpbm); - } - -- LogPal = GdipAlloc(sizeof(LOGPALETTE)); -- ok(LogPal != NULL, "unable to allocate LOGPALETTE\n"); - LogPal->palVersion = 0x300; -- LogPal->palNumEntries = 1; -+ LogPal->palNumEntries = 8; -+ for (i = 0; i < 8; i++) -+ { -+ LogPal->palPalEntry[i].peRed = i; -+ LogPal->palPalEntry[i].peGreen = i; -+ LogPal->palPalEntry[i].peBlue = i; -+ LogPal->palPalEntry[i].peFlags = 0; -+ } -+ - hpal = CreatePalette(LogPal); - ok(hpal != NULL, "CreatePalette failed\n"); -- GdipFree(LogPal); - - stat = GdipCreateBitmapFromHBITMAP(hbm, hpal, &gpbm); - expect(Ok, stat); -+ stat = GdipGetImagePalette((GpImage *)gpbm, palette, sizeof(colorpalette_buf)); -+ expect(Ok, stat); -+ expect(0, palette->Count); -+ GdipDisposeImage((GpImage*)gpbm); -+ DeleteObject(hbm); - -- if (stat == Ok) -- GdipDisposeImage((GpImage*)gpbm); -+ for (i = 0; i < 16; i++) -+ { -+ RGBQUAD *colors = bmi.bi.bmiColors; -+ BYTE clr = 255 - i; -+ colors[i].rgbBlue = clr; -+ colors[i].rgbGreen = clr; -+ colors[i].rgbRed = clr; -+ colors[i].rgbReserved = 0; -+ } -+ -+ bmi.bi.bmiHeader.biBitCount = 8; -+ bmi.bi.bmiHeader.biClrUsed = 16; -+ bmi.bi.bmiHeader.biClrImportant = 16; -+ hbm = CreateDIBSection(hdc, &bmi.bi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); -+ ok(hbm != NULL, "CreateDIBSection failed\n"); -+ -+ stat = GdipCreateBitmapFromHBITMAP(hbm, hpal, &gpbm); -+ expect(Ok, stat); -+ stat = GdipGetImagePixelFormat((GpImage*)gpbm, &format); -+ expect(Ok, stat); -+ expect(PixelFormat8bppIndexed, format); -+ stat = GdipGetImagePalette((GpImage *)gpbm, palette, sizeof(colorpalette_buf)); -+ expect(Ok, stat); -+ expect(256, palette->Count); -+ for (i = 0; i < 16; i++) -+ { -+ BYTE clr = 255 - i; -+ ARGB argb = 0xff000000 | (clr << 16) | (clr << 8) | clr; -+ ok(palette->Entries[i] == argb, "got %08x, expected %08x\n", palette->Entries[i], argb); -+ } -+ GdipDisposeImage((GpImage*)gpbm); - - DeleteObject(hpal); -+ -+ stat = GdipCreateBitmapFromHBITMAP(hbm, 0, &gpbm); -+ expect(Ok, stat); -+ stat = GdipGetImagePixelFormat((GpImage*)gpbm, &format); -+ expect(Ok, stat); -+ expect(PixelFormat8bppIndexed, format); -+ stat = GdipGetImagePalette((GpImage *)gpbm, palette, sizeof(colorpalette_buf)); -+ expect(Ok, stat); -+ expect(256, palette->Count); -+ for (i = 0; i < 16; i++) -+ { -+ BYTE clr = 255 - i; -+ ARGB argb = 0xff000000 | (clr << 16) | (clr << 8) | clr; -+ ok(palette->Entries[i] == argb, "got %08x, expected %08x\n", palette->Entries[i], argb); -+ } -+ GdipDisposeImage((GpImage*)gpbm); -+ - DeleteObject(hbm); - - /* 16-bit 555 dib, rgb */ -@@ -999,7 +1069,7 @@ static void test_GdipCreateBitmapFromHBITMAP(void) - DeleteObject(hbm); - - /* 16-bit 555 dib, with bitfields */ -- bmi.bi.bmiHeader.biSize = sizeof(bmi); -+ bmi.bi.bmiHeader.biSize = sizeof(bmi.bi.bmiHeader); - bmi.bi.bmiHeader.biCompression = BI_BITFIELDS; - bmi.bf.masks[0] = 0x7c00; - bmi.bf.masks[1] = 0x3e0; --- -2.24.0 - diff --git a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/definition b/patches/gdiplus-GdipCreateBitmapFromHBITMAP/definition deleted file mode 100644 index f8f1fcbe..00000000 --- a/patches/gdiplus-GdipCreateBitmapFromHBITMAP/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [48338] Unknown application paints GIF images incorrectly. diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 631a1571..0a1169ab 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "9a9a1821a34d10bb3e96ce1e42a8d046133f0958" + echo "cf6546fb3b914dc1d87b23d6920526b7487cfd6d" } # Show version information @@ -150,7 +150,6 @@ patch_enable_all () enable_gdi32_Lazy_Font_Initialization="$1" enable_gdi32_rotation="$1" enable_gdiplus_FontFamily_RefCount="$1" - enable_gdiplus_GdipCreateBitmapFromHBITMAP="$1" enable_gdiplus_Performance_Improvements="$1" enable_imagehlp_BindImageEx="$1" enable_imm32_message_on_focus="$1" @@ -580,9 +579,6 @@ patch_enable () gdiplus-FontFamily-RefCount) enable_gdiplus_FontFamily_RefCount="$2" ;; - gdiplus-GdipCreateBitmapFromHBITMAP) - enable_gdiplus_GdipCreateBitmapFromHBITMAP="$2" - ;; gdiplus-Performance-Improvements) enable_gdiplus_Performance_Improvements="$2" ;; @@ -4137,25 +4133,6 @@ if test "$enable_gdiplus_FontFamily_RefCount" -eq 1; then ) >> "$patchlist" fi -# Patchset gdiplus-GdipCreateBitmapFromHBITMAP -# | -# | This patchset fixes the following Wine bugs: -# | * [#48338] Unknown application paints GIF images incorrectly. -# | -# | Modified files: -# | * dlls/gdiplus/image.c, dlls/gdiplus/tests/image.c -# | -if test "$enable_gdiplus_GdipCreateBitmapFromHBITMAP" -eq 1; then - patch_apply gdiplus-GdipCreateBitmapFromHBITMAP/0001-gdiplus-GdipCreateBitmapFromHBITMAP-should-use-palet.patch - patch_apply gdiplus-GdipCreateBitmapFromHBITMAP/0002-gdiplus-Reimplement-GdipCreateBitmapFromGdiDib-by-us.patch - patch_apply gdiplus-GdipCreateBitmapFromHBITMAP/0003-gdiplus-tests-Add-more-tests-for-GdipCreateBitmapFro.patch - ( - printf '%s\n' '+ { "Dmitry Timoshkov", "gdiplus: GdipCreateBitmapFromHBITMAP should use palette from the GDI bitmap.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "gdiplus: Reimplement GdipCreateBitmapFromGdiDib by using GdipCreateBitmapFromHBITMAP.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "gdiplus/tests: Add more tests for GdipCreateBitmapFromHBITMAP and palette images.", 1 },'; - ) >> "$patchlist" -fi - # Patchset gdiplus-Performance-Improvements # | # | Modified files: