Files
image_pixman/test/utils.h
Søren Sandmann Pedersen 042f978b04 test: Add new alphamap test program.
This program demonstrates three bugs relating to alpha maps:

- When fetching from an alpha map into 32 bit intermediates, we use
  the fetcher from the image, and not the one from the alpha map.

- For 64 bit intermediates we call fetch_pixel_generic_lossy_32()
  which then calls fetch_pixel_raw_64, which is NULL because alpha
  images are never validated.

- The alpha map should be used *in place* of any existing alpha
  channel, but we are actually multiplying it onto the image.
2010-01-17 16:47:15 -05:00

46 lines
833 B
C

#include <stdlib.h>
#include <config.h>
#include "pixman-private.h" /* For 'inline' definition */
/* A primitive pseudorandom number generator,
* taken from POSIX.1-2001 example
*/
extern uint32_t lcg_seed;
static inline uint32_t
lcg_rand (void)
{
lcg_seed = lcg_seed * 1103515245 + 12345;
return ((uint32_t)(lcg_seed / 65536) % 32768);
}
static inline void
lcg_srand (uint32_t seed)
{
lcg_seed = seed;
}
static inline uint32_t
lcg_rand_n (int max)
{
return lcg_rand () % max;
}
/* CRC 32 computation
*/
uint32_t
compute_crc32 (uint32_t in_crc32,
const void *buf,
size_t buf_len);
/* perform endian conversion of pixel data
*/
void
image_endian_swap (pixman_image_t *img, int bpp);
/* Generate n_bytes random bytes in malloced memory */
uint8_t *
make_random_bytes (int n_bytes);