From c44e26473acd04ef694164bbff7bc13df965f57d Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Fri, 27 May 2005 20:07:48 +0000 Subject: [PATCH] Implement NtGdiGetSystemPaletteUse and NtGdiSetSystemPaletteUse this code have been taken from wine svn path=/trunk/; revision=15549 --- reactos/subsys/win32k/objects/color.c | 31 ++++++++++++++++++++++----- reactos/w32api/include/wingdi.h | 6 ++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/reactos/subsys/win32k/objects/color.c b/reactos/subsys/win32k/objects/color.c index cbeaf8967a2..d2cd8130878 100644 --- a/reactos/subsys/win32k/objects/color.c +++ b/reactos/subsys/win32k/objects/color.c @@ -31,6 +31,9 @@ static HPALETTE hPrimaryPalette = 0; // used for WM_PALETTECHANGED #endif //static HPALETTE hLastRealizedPalette = 0; // UnrealizeObject() needs it + +static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */ + const PALETTEENTRY COLOR_sysPalTemplate[NB_RESERVED_COLORS] = { // first 10 entries in the system palette @@ -286,9 +289,8 @@ UINT STDCALL NtGdiGetSystemPaletteEntries(HDC hDC, } UINT STDCALL NtGdiGetSystemPaletteUse(HDC hDC) -{ - DPRINT1("NtGdiGetSystemPaletteUse is unimplemented\n"); - return 0; +{ + return SystemPaletteUse; } /*! @@ -520,8 +522,27 @@ UINT STDCALL NtGdiSetPaletteEntries(HPALETTE hpal, UINT STDCALL NtGdiSetSystemPaletteUse(HDC hDC, UINT Usage) { - UNIMPLEMENTED; - return 0; + UINT old = SystemPaletteUse; + + /* Device doesn't support colour palettes */ + if (!(NtGdiGetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)) { + return SYSPAL_ERROR; + } + + switch (Usage) + { + case SYSPAL_NOSTATIC: + case SYSPAL_NOSTATIC256: + case SYSPAL_STATIC: + SystemPaletteUse = Usage; + break; + + default: + old=SYSPAL_ERROR; + break; + } + + return old; } BOOL STDCALL diff --git a/reactos/w32api/include/wingdi.h b/reactos/w32api/include/wingdi.h index 8ae6ad60357..e7f488a9996 100644 --- a/reactos/w32api/include/wingdi.h +++ b/reactos/w32api/include/wingdi.h @@ -8,6 +8,12 @@ extern "C" { #endif +/* Get/SetSystemPaletteUse() values */ +#define SYSPAL_ERROR 0 +#define SYSPAL_STATIC 1 +#define SYSPAL_NOSTATIC 2 +#define SYSPAL_NOSTATIC256 3 + #define WINGDIAPI #define BI_RGB 0 #define BI_RLE8 1