Exemple #1
0
/*
 * Find the colour depth of the display
 */
static int get_display_depth(void)
{
	const SDL_VideoInfo *vid_info;
	int depth = 0;

	if ((vid_info = SDL_GetVideoInfo())) {
		depth = vid_info->vfmt->BitsPerPixel;

		/* Don't trust the answer if it's 16 bits; the display
		* could actually be 15 bits deep. We'll count the bits
		* ourselves */
		if (depth == 16)
			depth = bits_in_mask(vid_info->vfmt->Rmask) + bits_in_mask(vid_info->vfmt->Gmask) + bits_in_mask(vid_info->vfmt->Bmask);
	}
	return depth;
}
Exemple #2
0
static int init_colors(void)
{
	int red_bits, green_bits, blue_bits;
	int red_shift, green_shift, blue_shift;

	/* Truecolor: */
	red_bits = bits_in_mask(prSDLScreen->format->Rmask);
	green_bits = bits_in_mask(prSDLScreen->format->Gmask);
	blue_bits = bits_in_mask(prSDLScreen->format->Bmask);
	red_shift = mask_shift(prSDLScreen->format->Rmask);
	green_shift = mask_shift(prSDLScreen->format->Gmask);
	blue_shift = mask_shift(prSDLScreen->format->Bmask);
	alloc_colors64k(red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift);
	notice_new_xcolors();

	return 1;
}
Exemple #3
0
int anon_print_subnets(FILE *f) {
  if (num_subnets > MAX_ANON_SUBNETS) {
    fprintf(f, "error: %u anonymous subnets configured, but maximum is %u\n", 
	    num_subnets, MAX_ANON_SUBNETS);
    return failure;
  } else {
    unsigned int i;

    for (i=0; i<num_subnets; i++) {
      fprintf(f, "anon subnet %u: %s/%d\n", i, 
	      inet_ntoa(anon_subnet[i].addr),
	      bits_in_mask(&anon_subnet[i].mask, 4));
    }
  }
  return ok;
}