Source/ThunderBeast/QuakeToonProto1/linux/rw_x11.c
void SWimp_SetPalette( const unsigned char *palette )
{
	int i;
	XColor colors[256];

	if (!X11_active)
		return;

    if ( !palette )
        palette = ( const unsigned char * ) sw_state.currentpalette;
 
	for(i=0;i<256;i++) {
		st2d_8to16table[i]= xlib_rgb16(palette[i*4], palette[i*4+1],palette[i*4+2]);
		st2d_8to24table[i]= xlib_rgb24(palette[i*4], palette[i*4+1],palette[i*4+2]);
	}

	if (x_visinfo->class == PseudoColor && x_visinfo->depth == 8)
	{
		for (i=0 ; i<256 ; i++)
		{
			colors[i].pixel = i;
			colors[i].flags = DoRed|DoGreen|DoBlue;
			colors[i].red = palette[i*4] * 257;
			colors[i].green = palette[i*4+1] * 257;
			colors[i].blue = palette[i*4+2] * 257;
		}
		XStoreColors(dpy, x_cmap, colors, 256);
	}
}
/*
** SWimp_SetPalette
**
** System specific palette setting routine.  A NULL palette means
** to use the existing palette.  The palette is expected to be in
** a padded 4-byte xRGB format.
*/
SWimp_SetPalette
System specific palette setting routine.  A NULL palette means
to use the existing palette.  The palette is expected to be in
a padded 4-byte xRGB format.
SWimp_SetPalette System specific palette setting routine . A NULL palette means to use the existing palette . The palette is expected to be in a padded 4 - byte xRGB format .
void SWimp_SetPalette( const unsigned char *palette )
{
	int i;
	XColor colors[256];
	if (!X11_active)
		return;
    if ( !palette )
        palette = ( const unsigned char * ) sw_state.currentpalette;
	for(i=0;i<256;i++) {
		st2d_8to16table[i]= xlib_rgb16(palette[i*4], palette[i*4+1],palette[i*4+2]);
		st2d_8to24table[i]= xlib_rgb24(palette[i*4], palette[i*4+1],palette[i*4+2]);
	}
	if (x_visinfo->class == PseudoColor && x_visinfo->depth == 8)
	{
		for (i=0 ; i<256 ; i++)
		{
			colors[i].pixel = i;
			colors[i].flags = DoRed|DoGreen|DoBlue;
			colors[i].red = palette[i*4] * 257;
			colors[i].green = palette[i*4+1] * 257;
			colors[i].blue = palette[i*4+2] * 257;
		}
		XStoreColors(dpy, x_cmap, colors, 256);
	}
}
void SWimp_SetPalette ( const unsigned char * palette ) { int i ; XColor colors [ 256 ] ; if ( ! X11_active ) return ; if ( ! palette ) palette = ( const unsigned char * ) sw_state . currentpalette ; for ( i = 0 ; i < 256 ; i ++ ) { st2d_8to16table [ i ] = xlib_rgb16 ( palette [ i * 4 ] , palette [ i * 4 + 1 ] , palette [ i * 4 + 2 ] ) ; st2d_8to24table [ i ] = xlib_rgb24 ( palette [ i * 4 ] , palette [ i * 4 + 1 ] , palette [ i * 4 + 2 ] ) ; } if ( x_visinfo -> class == PseudoColor && x_visinfo -> depth == 8 ) { for ( i = 0 ; i < 256 ; i ++ ) { colors [ i ] . pixel = i ; colors [ i ] . flags = DoRed | DoGreen | DoBlue ; colors [ i ] . red = palette [ i * 4 ] * 257 ; colors [ i ] . green = palette [ i * 4 + 1 ] * 257 ; colors [ i ] . blue = palette [ i * 4 + 2 ] * 257 ; } XStoreColors ( dpy , x_cmap , colors , 256 ) ; } }
SWimp_SetPalette
System specific palette setting routine.
SWimp_SetPalette System specific palette setting routine .