summaryrefslogtreecommitdiff
path: root/libs/pixman-0.40.0/test/radial-invalid.c
blob: ec85fe32030293daaeea2184a431fa377a400ae8 (plain)
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
47
48
49
50
51
52
53
54
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "utils.h"

#define WIDTH 100
#define HEIGHT 100

int
main ()
{
    pixman_image_t *radial;
    pixman_image_t *dest = pixman_image_create_bits (
	PIXMAN_a8r8g8b8, WIDTH, HEIGHT, NULL, -1);

    static const pixman_transform_t xform =
	{
	    { { 0x346f7, 0x0, 0x0 },
	      { 0x0, 0x346f7, 0x0 },
	      { 0x0, 0x0, 0x10000 }
	    },
	};

    static const pixman_gradient_stop_t stops[] = 
    {
	{ 0xde61, { 0x4481, 0x96e8, 0x1e6a, 0x29e1 } },
	{ 0xfdd5, { 0xfa10, 0xcc26, 0xbc43, 0x1eb7 } },
	{ 0xfe1e, { 0xd257, 0x5bac, 0x6fc2, 0xa33b } },
    };

    static const pixman_point_fixed_t inner = { 0x320000, 0x320000 };
    static const pixman_point_fixed_t outer = { 0x320000, 0x3cb074 };

    enable_divbyzero_exceptions ();
    enable_invalid_exceptions ();

    radial = pixman_image_create_radial_gradient (
	&inner,
	&outer,
	0xab074, /* inner radius */
	0x0,	 /* outer radius */
	stops, sizeof (stops) / sizeof (stops[0]));

    pixman_image_set_repeat (radial, PIXMAN_REPEAT_REFLECT);
    pixman_image_set_transform (radial, &xform);

    pixman_image_composite (
	PIXMAN_OP_OVER,
	radial, NULL, dest,
	0, 0, 0, 0,
	0, 0, WIDTH, HEIGHT);

    return 0;
}