Module: wine Branch: master Commit: c937634376838ef81aa3543f8f1a7e49b1e9ca50 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c937634376838ef81aa3543f8f...
Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Sun Feb 17 13:57:16 2008 +0000
gdi32: GetPaletteEntries should not filter peFlags (test included).
---
dlls/gdi32/palette.c | 3 --- dlls/gdi32/tests/palette.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c index ddf597e..1b6a966 100644 --- a/dlls/gdi32/palette.c +++ b/dlls/gdi32/palette.c @@ -300,9 +300,6 @@ UINT WINAPI GetPaletteEntries( } memcpy( entries, &palPtr->logpalette.palPalEntry[start], count * sizeof(PALETTEENTRY) ); - for( numEntries = 0; numEntries < count ; numEntries++ ) - if (entries[numEntries].peFlags & 0xF0) - entries[numEntries].peFlags = 0; }
GDI_ReleaseObj( hpalette ); diff --git a/dlls/gdi32/tests/palette.c b/dlls/gdi32/tests/palette.c index 40e6c7c..c9455ca 100644 --- a/dlls/gdi32/tests/palette.c +++ b/dlls/gdi32/tests/palette.c @@ -120,7 +120,33 @@ static void test_DIB_PAL_COLORS(void) { ReleaseDC( NULL, hdc ); }
+static void test_palette_entries(void) +{ + char logpalettebuf[sizeof(LOGPALETTE) + sizeof(logpalettedata)]; + PLOGPALETTE logpalette = (PLOGPALETTE)logpalettebuf; + HPALETTE hpal; + UINT res=0; + PALETTEENTRY palEntry = { 0x1, 0x2, 0x3, 0xff }; + PALETTEENTRY getEntryResult; + + /* Initalize the logical palette with a few colours */ + logpalette->palVersion = 0x300; + logpalette->palNumEntries = 8; + memcpy( logpalette->palPalEntry, logpalettedata, sizeof(logpalettedata) ); + hpal = CreatePalette( logpalette ); + + /* Set a new entry with peFlags to 0xff */ + SetPaletteEntries(hpal, 0, 1, &palEntry); + + /* Retrieve the entry to see if GDI32 performs any filtering on peFlags */ + res = GetPaletteEntries(hpal, 0, 1, &getEntryResult); + ok(res == 1, "GetPaletteEntries should have returned 1 but returned %d\n", res); + + ok( palEntry.peFlags == getEntryResult.peFlags, "palEntry.peFlags (%#x) != getEntryResult.peFlags (%#x)\n", palEntry.peFlags, getEntryResult.peFlags ); +} + START_TEST(palette) { test_DIB_PAL_COLORS(); + test_palette_entries(); }