/* Calculate an 8-bit (3 red, 3 green, 2 blue) dithered palette of colors  */
void SDL_DitherColors(SDL_Color *colors, int bpp)
/* Calculate an 8-bit (3 red, 3 green, 2 blue) dithered palette of colors  */
void SDL_DitherColors(SDL_Color *colors, int bpp)
{
	int i;
	if(bpp != 8)
		return;
	for(i = 0; i < 256; i++) {
		int r, g, b;
		r = i & 0xe0;
		r |= r >> 3 | r >> 6;
		colors[i].r = r;
		g = (i << 3) & 0xe0;
		g |= g >> 3 | g >> 6;
		colors[i].g = g;
		b = i & 0x3;
		b |= b << 2;
		b |= b << 4;
		colors[i].b = b;
	}
}