Commit 9c90cc89 authored by Gregg Mattinson's avatar Gregg Mattinson Committed by Alexandre Julliard

Replaced 0 by -1 to indicate free entry in

X11DRV_PALETTE_XPixelToPalette.
parent d736e822
...@@ -93,6 +93,7 @@ int X11DRV_PALETTE_mapEGAPixel[16]; ...@@ -93,6 +93,7 @@ int X11DRV_PALETTE_mapEGAPixel[16];
/**********************************************************************/ /**********************************************************************/
#define NB_COLORCUBE_START_INDEX 63 #define NB_COLORCUBE_START_INDEX 63
#define NB_PALETTE_EMPTY_VALUE -1
/* Maps entry in the system palette to X pixel value */ /* Maps entry in the system palette to X pixel value */
int *X11DRV_PALETTE_PaletteToXPixel = NULL; int *X11DRV_PALETTE_PaletteToXPixel = NULL;
...@@ -566,11 +567,13 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) ...@@ -566,11 +567,13 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
if (screen_depth <= 8) if (screen_depth <= 8)
{ {
X11DRV_PALETTE_XPixelToPalette = (int*)calloc(256, sizeof(int)); X11DRV_PALETTE_XPixelToPalette = HeapAlloc( GetProcessHeap(), 0, 256 * sizeof(int) );
if(X11DRV_PALETTE_XPixelToPalette == NULL) { if(X11DRV_PALETTE_XPixelToPalette == NULL) {
ERR("Out of memory: XPixelToPalette!\n"); ERR("Out of memory: XPixelToPalette!\n");
return FALSE; return FALSE;
} }
for( i = 0; i < 256; i++ )
X11DRV_PALETTE_XPixelToPalette[i] = NB_PALETTE_EMPTY_VALUE;
} }
/* for hicolor visuals PaletteToPixel mapping is used to skip /* for hicolor visuals PaletteToPixel mapping is used to skip
...@@ -587,7 +590,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) ...@@ -587,7 +590,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
{ {
if( i >= COLOR_gapStart && i <= COLOR_gapEnd ) if( i >= COLOR_gapStart && i <= COLOR_gapEnd )
{ {
X11DRV_PALETTE_PaletteToXPixel[i] = 0; X11DRV_PALETTE_PaletteToXPixel[i] = NB_PALETTE_EMPTY_VALUE;
COLOR_sysPal[i].peFlags = 0; /* mark as unused */ COLOR_sysPal[i].peFlags = 0; /* mark as unused */
continue; continue;
} }
...@@ -691,7 +694,7 @@ static void X11DRV_PALETTE_FillDefaultColors(void) ...@@ -691,7 +694,7 @@ static void X11DRV_PALETTE_FillDefaultColors(void)
max = COLOR_max - (256 - (COLOR_gapEnd - COLOR_gapStart)); max = COLOR_max - (256 - (COLOR_gapEnd - COLOR_gapStart));
for ( i = 0, idx = COLOR_gapStart; i < 256 && idx <= COLOR_gapEnd; i++ ) for ( i = 0, idx = COLOR_gapStart; i < 256 && idx <= COLOR_gapEnd; i++ )
if( X11DRV_PALETTE_XPixelToPalette[i] == 0 ) if( X11DRV_PALETTE_XPixelToPalette[i] == NB_PALETTE_EMPTY_VALUE )
{ {
xc.pixel = i; xc.pixel = i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment