aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
blob: 2252215723fba4fecb0c033dc486da859567ab83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* See LICENSE file for copyright and license details. */
#ifndef LIBGLITTER_COMMON_H
#define LIBGLITTER_COMMON_H

#include "libglitter.h"
#include <alloca.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>


#define RENDER_METHOD_VSTRIPS 0
#define RENDER_METHOD_HSTRIPS 1
#define RENDER_METHOD_SIMPLE 2
#define RENDER_METHOD_GENERIC 3


struct libglitter_render_context {
	const uint8_t *restrict cellmap;
	const uint8_t *restrict ncellvalues;
	size_t noutputs;
	size_t rowsize;
	size_t widthmul;
	size_t heightmul;
	uint8_t render_method;
	size_t cells[3][2];
	double *restrict cellweights_double;
	float *restrict cellweights_float;
};


#ifdef TEST

# define ASSERT(ASSERTION)\
	do {\
		if (!(ASSERTION)) {\
			fprintf(stderr, "Failed assertion at line %i: %s\n", __LINE__, #ASSERTION);\
			exit(1);\
		}\
	} while (0)

#endif

#endif