Added patch to return default palette entries from GetSystemPaletteEntries for non-palette-based devices.

This commit is contained in:
Sebastian Lackner 2015-05-07 04:20:48 +02:00
parent d532c3b5bd
commit caf809b1d5
5 changed files with 229 additions and 18 deletions

View File

@ -39,10 +39,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [3]:**
**Bug fixes and features included in the next upcoming release [4]:**
* Add stub for atl80.AtlIPersistPropertyBag_Save ([Wine Bug #33888](https://bugs.winehq.org/show_bug.cgi?id=33888))
* Improve ReadDataAvailable handling in FilePipeLocalInformation class
* Return default palette entries from GetSystemPaletteEntries for non-palette-based devices
* Wait before reusing recently freed memory

2
debian/changelog vendored
View File

@ -8,6 +8,8 @@ wine-staging (1.7.43) UNRELEASED; urgency=low
FilePipeLocalInformation class.
* Added patch with tests for shlwapi.AssocGetPerceivedType.
* Added patch with stub for atl80.AtlIPersistPropertyBag_Save.
* Added patch to return default palette entries from GetSystemPaletteEntries
for non-palette-based devices.
* Removed patch to use lockfree implementation for FD cache (accepted
upstream).
* Removed patch to properly handle closing sockets during a select call

View File

@ -0,0 +1,191 @@
From f3e41ff12cb58ee6cb5c36a447cfdeeda3eb21a2 Mon Sep 17 00:00:00 2001
From: Anton Baskanov <baskanov@gmail.com>
Date: Fri, 1 May 2015 13:02:28 +0600
Subject: gdi32: Return default palette entries from GetSystemPaletteEntries
for non-palette-based devices.
Fixes rendering artifacts in Marble Drop.
Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Added additional tests.
* Fix comparison in GetSystemPaletteEntries.
---
dlls/gdi32/palette.c | 35 +++++++++++++-
dlls/gdi32/tests/palette.c | 112 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 145 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c
index d850d0f..70a75d8 100644
--- a/dlls/gdi32/palette.c
+++ b/dlls/gdi32/palette.c
@@ -418,8 +418,39 @@ UINT WINAPI GetSystemPaletteEntries(
if ((dc = get_dc_ptr( hdc )))
{
- PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetSystemPaletteEntries );
- ret = physdev->funcs->pGetSystemPaletteEntries( physdev, start, count, entries );
+ if (!(GetDeviceCaps( hdc, RASTERCAPS ) & RC_PALETTE))
+ {
+ if (entries && start < 256)
+ {
+ UINT i;
+ const RGBQUAD *default_entries;
+
+ if (start + count > 256) count = 256 - start;
+
+ default_entries = get_default_color_table( 8 );
+ for (i = 0; i < count; ++i)
+ {
+ if (start + i < 10 || start + i >= 246)
+ {
+ entries[i].peRed = default_entries[start + i].rgbRed;
+ entries[i].peGreen = default_entries[start + i].rgbGreen;
+ entries[i].peBlue = default_entries[start + i].rgbBlue;
+ }
+ else
+ {
+ entries[i].peRed = 0;
+ entries[i].peGreen = 0;
+ entries[i].peBlue = 0;
+ }
+ entries[i].peFlags = 0;
+ }
+ }
+ }
+ else
+ {
+ PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetSystemPaletteEntries );
+ ret = physdev->funcs->pGetSystemPaletteEntries( physdev, start, count, entries );
+ }
release_dc_ptr( dc );
}
return ret;
diff --git a/dlls/gdi32/tests/palette.c b/dlls/gdi32/tests/palette.c
index f95c0d3..09a00a5 100644
--- a/dlls/gdi32/tests/palette.c
+++ b/dlls/gdi32/tests/palette.c
@@ -191,9 +191,121 @@ static void test_halftone_palette(void)
ReleaseDC( 0, hdc );
}
+static void test_system_palette_entries(void)
+{
+ HDC hdc;
+ PALETTEENTRY entries[256];
+ PALETTEENTRY defpal[20];
+ int i, count;
+
+ hdc = GetDC(0);
+
+ if (!(GetDeviceCaps( hdc, RASTERCAPS ) & RC_PALETTE))
+ {
+ memset( defpal, 0xaa, sizeof(defpal) );
+ count = GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, 20, defpal );
+ ok( count == 20, "wrong size %u\n", count );
+
+ memset( entries, 0x55, sizeof(entries) );
+ count = GetSystemPaletteEntries( hdc, 0, 256, entries );
+ ok( count == 0, "wrong size %u\n", count);
+ for (i = 0; i < 10; i++)
+ {
+ ok( entries[i].peRed == defpal[i].peRed &&
+ entries[i].peGreen == defpal[i].peGreen &&
+ entries[i].peBlue == defpal[i].peBlue &&
+ !entries[i].peFlags,
+ "%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
+ entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
+ defpal[i].peRed, defpal[i].peGreen, defpal[i].peBlue );
+ }
+ for (i = 10; i < 246; ++i)
+ {
+ ok( !entries[i].peRed &&
+ !entries[i].peGreen &&
+ !entries[i].peBlue &&
+ !entries[i].peFlags,
+ "%u: wrong color %02x,%02x,%02x,%02x instead of 0,0,0\n", i,
+ entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags);
+ }
+ for (i = 246; i < 256; i++)
+ {
+ int idx = i - 246 + 10;
+ ok( entries[i].peRed == defpal[idx].peRed &&
+ entries[i].peGreen == defpal[idx].peGreen &&
+ entries[i].peBlue == defpal[idx].peBlue &&
+ !entries[i].peFlags,
+ "%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
+ entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
+ defpal[idx].peRed, defpal[idx].peGreen, defpal[idx].peBlue );
+ }
+
+ memset( entries, 0x55, sizeof(entries) );
+ count = GetSystemPaletteEntries( hdc, 0, 10, entries );
+ ok( count == 0, "wrong size %u\n", count);
+ for (i = 0; i < 10; i++)
+ {
+ ok( entries[i].peRed == defpal[i].peRed &&
+ entries[i].peGreen == defpal[i].peGreen &&
+ entries[i].peBlue == defpal[i].peBlue &&
+ !entries[i].peFlags,
+ "%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
+ entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
+ defpal[i].peRed, defpal[i].peGreen, defpal[i].peBlue );
+ }
+
+ memset( entries, 0x55, sizeof(entries) );
+ count = GetSystemPaletteEntries( hdc, 10, 246, entries );
+ ok( count == 0, "wrong size %u\n", count);
+ for (i = 0; i < 236; ++i)
+ {
+ ok( !entries[i].peRed &&
+ !entries[i].peGreen &&
+ !entries[i].peBlue &&
+ !entries[i].peFlags,
+ "%u: wrong color %02x,%02x,%02x,%02x instead of 0,0,0\n", i,
+ entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags);
+ }
+ for (i = 236; i < 246; i++)
+ {
+ int idx = i - 236 + 10;
+ ok( entries[i].peRed == defpal[idx].peRed &&
+ entries[i].peGreen == defpal[idx].peGreen &&
+ entries[i].peBlue == defpal[idx].peBlue &&
+ !entries[i].peFlags,
+ "%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
+ entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
+ defpal[idx].peRed, defpal[idx].peGreen, defpal[idx].peBlue );
+ }
+
+ memset( entries, 0x55, sizeof(entries) );
+ count = GetSystemPaletteEntries( hdc, 246, 10, entries );
+ ok( count == 0, "wrong size %u\n", count);
+ for (i = 0; i < 10; i++)
+ {
+ int idx = i + 10;
+ ok( entries[i].peRed == defpal[idx].peRed &&
+ entries[i].peGreen == defpal[idx].peGreen &&
+ entries[i].peBlue == defpal[idx].peBlue &&
+ !entries[i].peFlags,
+ "%u: wrong color %02x,%02x,%02x,%02x instead of %02x,%02x,%02x\n", i,
+ entries[i].peRed, entries[i].peGreen, entries[i].peBlue, entries[i].peFlags,
+ defpal[idx].peRed, defpal[idx].peGreen, defpal[idx].peBlue );
+ }
+
+ }
+ else
+ {
+ skip( "device is palette-based, skipping test\n" );
+ }
+
+ ReleaseDC( 0, hdc );
+}
+
START_TEST(palette)
{
test_DIB_PAL_COLORS();
test_palette_entries();
test_halftone_palette();
+ test_system_palette_entries();
}
--
2.3.7

View File

@ -0,0 +1 @@
Fixes: Return default palette entries from GetSystemPaletteEntries for non-palette-based devices

View File

@ -119,6 +119,7 @@ patch_enable_all ()
enable_dxva2_Video_Decoder="$1"
enable_fltmgr_Stub_SYS="$1"
enable_fonts_Missing_Fonts="$1"
enable_gdi32_Default_Palette="$1"
enable_gdi32_MaxPixelFormats="$1"
enable_gdi32_MultiMonitor="$1"
enable_gdiplus_GdipCreateEffect="$1"
@ -411,6 +412,9 @@ patch_enable ()
fonts-Missing_Fonts)
enable_fonts_Missing_Fonts="$2"
;;
gdi32-Default_Palette)
enable_gdi32_Default_Palette="$2"
;;
gdi32-MaxPixelFormats)
enable_gdi32_MaxPixelFormats="$2"
;;
@ -1754,6 +1758,23 @@ if test "$enable_advapi32_ImpersonateAnonymousToken" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-Misc_ACL
# |
# | This patchset fixes the following Wine bugs:
# | * [#15980] GetSecurityInfo returns NULL DACL for process object
# |
# | Modified files:
# | * dlls/advapi32/tests/security.c, server/process.c, server/security.h, server/token.c
# |
if test "$enable_server_Misc_ACL" -eq 1; then
patch_apply server-Misc_ACL/0001-server-Add-default-security-descriptor-ownership-for.patch
patch_apply server-Misc_ACL/0002-server-Add-default-security-descriptor-DACL-for-proc.patch
(
echo '+ { "Erich E. Hoover", "server: Add default security descriptor ownership for processes.", 1 },';
echo '+ { "Erich E. Hoover", "server: Add default security descriptor DACL for processes.", 1 },';
) >> "$patchlist"
fi
# Patchset server-CreateProcess_ACLs
# |
# | This patchset fixes the following Wine bugs:
@ -1773,23 +1794,6 @@ if test "$enable_server_CreateProcess_ACLs" -eq 1; then
) >> "$patchlist"
fi
# Patchset server-Misc_ACL
# |
# | This patchset fixes the following Wine bugs:
# | * [#15980] GetSecurityInfo returns NULL DACL for process object
# |
# | Modified files:
# | * dlls/advapi32/tests/security.c, server/process.c, server/security.h, server/token.c
# |
if test "$enable_server_Misc_ACL" -eq 1; then
patch_apply server-Misc_ACL/0001-server-Add-default-security-descriptor-ownership-for.patch
patch_apply server-Misc_ACL/0002-server-Add-default-security-descriptor-DACL-for-proc.patch
(
echo '+ { "Erich E. Hoover", "server: Add default security descriptor ownership for processes.", 1 },';
echo '+ { "Erich E. Hoover", "server: Add default security descriptor DACL for processes.", 1 },';
) >> "$patchlist"
fi
# Patchset advapi32-LsaLookupSids
# |
# | Modified files:
@ -2971,6 +2975,18 @@ if test "$enable_fonts_Missing_Fonts" -eq 1; then
) >> "$patchlist"
fi
# Patchset gdi32-Default_Palette
# |
# | Modified files:
# | * dlls/gdi32/palette.c, dlls/gdi32/tests/palette.c
# |
if test "$enable_gdi32_Default_Palette" -eq 1; then
patch_apply gdi32-Default_Palette/0001-gdi32-Return-default-palette-entries-from-GetSystemP.patch
(
echo '+ { "Anton Baskanov", "gdi32: Return default palette entries from GetSystemPaletteEntries for non-palette-based devices.", 1 },';
) >> "$patchlist"
fi
# Patchset gdi32-MaxPixelFormats
# |
# | This patchset fixes the following Wine bugs: