~ubuntu-branches/ubuntu/quantal/pixman/quantal-updates

« back to all changes in this revision

Viewing changes to test/composite-traps-test.c

  • Committer: Package Import Robot
  • Author(s): Maarten Lankhorst
  • Date: 2013-12-10 13:26:08 UTC
  • mfrom: (30.2.1 quantal-proposed)
  • Revision ID: package-import@ubuntu.com-20131210132608-alsfghr07ame45al
Tags: 0.30.2-1ubuntu0.0.0.1
Copy saucy package back to quantal. (LP: #1253041)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
};
27
27
 
28
28
#define RANDOM_ELT(array)                                               \
29
 
    ((array)[lcg_rand_n(ARRAY_LENGTH((array)))])
 
29
    ((array)[prng_rand_n(ARRAY_LENGTH((array)))])
30
30
 
31
31
static void
32
32
destroy_bits (pixman_image_t *image, void *data)
37
37
static pixman_fixed_t
38
38
random_fixed (int n)
39
39
{
40
 
    return lcg_rand_N (n << 16);
 
40
    return prng_rand_n (n << 16);
41
41
}
42
42
 
43
43
/*
75
75
    
76
76
    FLOAT_REGS_CORRUPTION_DETECTOR_START ();
77
77
 
78
 
    lcg_srand (testnum);
 
78
    prng_srand (testnum);
79
79
 
80
80
    op = RANDOM_ELT (operators);
81
81
    mask_format = RANDOM_ELT (mask_formats);
82
82
 
83
83
    /* Create source image */
84
84
    
85
 
    if (lcg_rand_n (4) == 0)
 
85
    if (prng_rand_n (4) == 0)
86
86
    {
87
87
        src_img = pixman_image_create_solid_fill (
88
 
            &(colors[lcg_rand_n (ARRAY_LENGTH (colors))]));
 
88
            &(colors[prng_rand_n (ARRAY_LENGTH (colors))]));
89
89
 
90
90
        src_x = 10;
91
91
        src_y = 234;
94
94
    {
95
95
        pixman_format_code_t src_format = RANDOM_ELT(formats);
96
96
        int src_bpp = (PIXMAN_FORMAT_BPP (src_format) + 7) / 8;
97
 
        int src_width = lcg_rand_n (MAX_SRC_WIDTH) + 1;
98
 
        int src_height = lcg_rand_n (MAX_SRC_HEIGHT) + 1;
99
 
        int src_stride = src_width * src_bpp + lcg_rand_n (MAX_STRIDE) * src_bpp;
 
97
        int src_width = prng_rand_n (MAX_SRC_WIDTH) + 1;
 
98
        int src_height = prng_rand_n (MAX_SRC_HEIGHT) + 1;
 
99
        int src_stride = src_width * src_bpp + prng_rand_n (MAX_STRIDE) * src_bpp;
100
100
        uint32_t *bits;
101
101
 
102
 
        src_x = -(src_width / 4) + lcg_rand_n (src_width * 3 / 2);
103
 
        src_y = -(src_height / 4) + lcg_rand_n (src_height * 3 / 2);
 
102
        src_x = -(src_width / 4) + prng_rand_n (src_width * 3 / 2);
 
103
        src_y = -(src_height / 4) + prng_rand_n (src_height * 3 / 2);
104
104
 
105
105
        src_stride = (src_stride + 3) & ~3;
106
106
        
111
111
 
112
112
        pixman_image_set_destroy_function (src_img, destroy_bits, bits);
113
113
 
114
 
        if (lcg_rand_n (8) == 0)
 
114
        if (prng_rand_n (8) == 0)
115
115
        {
116
116
            pixman_box16_t clip_boxes[2];
117
 
            int            n = lcg_rand_n (2) + 1;
 
117
            int            n = prng_rand_n (2) + 1;
118
118
            
119
119
            for (i = 0; i < n; i++)
120
120
            {
121
 
                clip_boxes[i].x1 = lcg_rand_n (src_width);
122
 
                clip_boxes[i].y1 = lcg_rand_n (src_height);
 
121
                clip_boxes[i].x1 = prng_rand_n (src_width);
 
122
                clip_boxes[i].y1 = prng_rand_n (src_height);
123
123
                clip_boxes[i].x2 =
124
 
                    clip_boxes[i].x1 + lcg_rand_n (src_width - clip_boxes[i].x1);
 
124
                    clip_boxes[i].x1 + prng_rand_n (src_width - clip_boxes[i].x1);
125
125
                clip_boxes[i].y2 =
126
 
                    clip_boxes[i].y1 + lcg_rand_n (src_height - clip_boxes[i].y1);
 
126
                    clip_boxes[i].y1 + prng_rand_n (src_height - clip_boxes[i].y1);
127
127
                
128
128
                if (verbose)
129
129
                {
146
146
    {
147
147
        dst_format = RANDOM_ELT(formats);
148
148
        dst_bpp = (PIXMAN_FORMAT_BPP (dst_format) + 7) / 8;
149
 
        dst_width = lcg_rand_n (MAX_DST_WIDTH) + 1;
150
 
        dst_height = lcg_rand_n (MAX_DST_HEIGHT) + 1;
151
 
        dst_stride = dst_width * dst_bpp + lcg_rand_n (MAX_STRIDE) * dst_bpp;
 
149
        dst_width = prng_rand_n (MAX_DST_WIDTH) + 1;
 
150
        dst_height = prng_rand_n (MAX_DST_HEIGHT) + 1;
 
151
        dst_stride = dst_width * dst_bpp + prng_rand_n (MAX_STRIDE) * dst_bpp;
152
152
        dst_stride = (dst_stride + 3) & ~3;
153
153
        
154
154
        dst_bits = (uint32_t *)make_random_bytes (dst_stride * dst_height);
155
155
 
156
 
        dst_x = -(dst_width / 4) + lcg_rand_n (dst_width * 3 / 2);
157
 
        dst_y = -(dst_height / 4) + lcg_rand_n (dst_height * 3 / 2);
 
156
        dst_x = -(dst_width / 4) + prng_rand_n (dst_width * 3 / 2);
 
157
        dst_y = -(dst_height / 4) + prng_rand_n (dst_height * 3 / 2);
158
158
        
159
159
        dst_img = pixman_image_create_bits (
160
160
            dst_format, dst_width, dst_height, dst_bits, dst_stride);
166
166
    {
167
167
        int i;
168
168
 
169
 
        n_traps = lcg_rand_n (25);
 
169
        n_traps = prng_rand_n (25);
170
170
        traps = fence_malloc (n_traps * sizeof (pixman_trapezoid_t));
171
171
 
172
172
        for (i = 0; i < n_traps; ++i)
186
186
        }
187
187
    }
188
188
    
189
 
    if (lcg_rand_n (8) == 0)
 
189
    if (prng_rand_n (8) == 0)
190
190
    {
191
191
        pixman_box16_t clip_boxes[2];
192
 
        int            n = lcg_rand_n (2) + 1;
 
192
        int            n = prng_rand_n (2) + 1;
193
193
        for (i = 0; i < n; i++)
194
194
        {
195
 
            clip_boxes[i].x1 = lcg_rand_n (dst_width);
196
 
            clip_boxes[i].y1 = lcg_rand_n (dst_height);
 
195
            clip_boxes[i].x1 = prng_rand_n (dst_width);
 
196
            clip_boxes[i].y1 = prng_rand_n (dst_height);
197
197
            clip_boxes[i].x2 =
198
 
                clip_boxes[i].x1 + lcg_rand_n (dst_width - clip_boxes[i].x1);
 
198
                clip_boxes[i].x1 + prng_rand_n (dst_width - clip_boxes[i].x1);
199
199
            clip_boxes[i].y2 =
200
 
                clip_boxes[i].y1 + lcg_rand_n (dst_height - clip_boxes[i].y1);
 
200
                clip_boxes[i].y1 + prng_rand_n (dst_height - clip_boxes[i].y1);
201
201
 
202
202
            if (verbose)
203
203
            {
251
251
int
252
252
main (int argc, const char *argv[])
253
253
{
254
 
    return fuzzer_test_main("composite traps", 40000, 0xE3112106,
 
254
    return fuzzer_test_main("composite traps", 40000, 0x749BCC57,
255
255
                            test_composite, argc, argv);
256
256
}