Exemplo n.º 1
0
/**
 * Read a bitmap filedata to an 'bitmap' structure
 * @param bmp Pointer to destination 'bitmap' structure 
 * @param num_of_obj Number different bitmap objects
 * @param num_of_images Number of images for a same bitmap
 * @param addr Pointer to the source bitmap filedata 
 * @param width Width of the bitmap in pixels
 * @return The source pointer incremented
 */
static char *
bitmap_read (bitmap * bmp, Uint32 num_of_obj, Uint32 num_of_images,
             char *addr, Uint32 max_of_anims)
{
  Uint32 i, j;
  for (i = 0; i < num_of_obj; i++)
    {
      for (j = 0; j < num_of_images; j++)
        {
          addr = bitmap_extract (bmp + (i * max_of_anims) + j, addr);
          if (addr == NULL)
            {
              LOG_ERR ("bitmap_extract() failed!");
              return NULL;
            }
        }
    }
  return addr;
}
Exemplo n.º 2
0
char *
seed_to_string(int sn)
{
  static char buffer[100];
  bitmap_type tmp;
  int i;

  buffer[seed[sn].span] = 0;
  for (i = seed[sn].span - 1, tmp = seed[sn].mask[0];
       i >= 0;
       i--, tmp >>= 1) {
    if (bitmap_extract(&tmp, 1, 0) == 1)
      buffer[i] = '1';
    else
      buffer[i] = '0';
  }

  return buffer;
}
Exemplo n.º 3
0
void
init_seed_hash_mask()
{
  int i, sn;

  seed_hash_mask = (uint32_t **)
    //xmalloc(sizeof(seed_hash_mask[0]) * n_seeds);
    my_malloc(n_seeds * sizeof(seed_hash_mask[0]),
	      &mem_small, "seed_hash_mask");
  for (sn = 0; sn < n_seeds; sn++) {
    seed_hash_mask[sn] = (uint32_t *)
      //xcalloc(sizeof(seed_hash_mask[sn][0]) * BPTO32BW(max_seed_span));
      my_calloc(BPTO32BW(max_seed_span) * sizeof(seed_hash_mask[sn][0]),
		&mem_small, "seed_hash_mask[%d]", sn);

    for (i = seed[sn].span - 1; i >= 0; i--)
      bitfield_prepend(seed_hash_mask[sn], max_seed_span,
		       bitmap_extract(seed[sn].mask, 1, i) == 1? 0xf : 0x0);
  }
}