Extended SetSystemPaletteUse to deal with error conditions.

This commit is contained in:
Andrew John Hughes 2003-02-01 00:36:38 +00:00 committed by Alexandre Julliard
parent 043680c140
commit 6f929659bd
2 changed files with 20 additions and 7 deletions

View File

@ -1386,10 +1386,11 @@ typedef struct
#define TT_POLYGON_TYPE 24
/* Get/SetSystemPaletteUse() values */
#define SYSPAL_ERROR 0
#define SYSPAL_STATIC 1
#define SYSPAL_NOSTATIC 2
#define SYSPAL_ERROR 0
#define SYSPAL_STATIC 1
#define SYSPAL_NOSTATIC 2
#define SYSPAL_NOSTATIC256 3
#ifndef _PALETTEENTRY_DEFINED
#define _PALETTEENTRY_DEFINED
typedef struct tagPALETTEENTRY

View File

@ -454,9 +454,21 @@ UINT WINAPI SetSystemPaletteUse(
UINT use) /* [in] Palette-usage flag */
{
UINT old = SystemPaletteUse;
FIXME("(%p,%04x): stub\n", hdc, use );
SystemPaletteUse = use;
return old;
/* Device doesn't support colour palettes */
if (!(GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)) {
return SYSPAL_ERROR;
}
switch (use) {
case SYSPAL_NOSTATIC:
case SYSPAL_NOSTATIC256: /* WINVER >= 0x0500 */
case SYSPAL_STATIC:
SystemPaletteUse = use;
return old;
default:
return SYSPAL_ERROR;
}
}