summaryrefslogtreecommitdiff
path: root/test/render-trapezoid.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/render-trapezoid.c')
-rw-r--r--test/render-trapezoid.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/test/render-trapezoid.c b/test/render-trapezoid.c
index 811d9093..cd990143 100644
--- a/test/render-trapezoid.c
+++ b/test/render-trapezoid.c
@@ -79,7 +79,7 @@ static void pixel_tests(struct test *t, int reps, int sets, enum target target)
{
struct test_target tt;
XImage image;
- uint32_t *cells = malloc(t->real.width*t->real.height*4);
+ uint32_t *cells = malloc(t->out.width*t->out.height*4);
struct {
uint16_t x, y;
} *pixels = malloc(reps*sizeof(*pixels));
@@ -88,7 +88,7 @@ static void pixel_tests(struct test *t, int reps, int sets, enum target target)
printf("Testing setting of single pixels (%s): ", test_target_name(target));
fflush(stdout);
- test_target_create_render(&t->real, target, &tt);
+ test_target_create_render(&t->out, target, &tt);
for (s = 0; s < sets; s++) {
for (r = 0; r < reps; r++) {
@@ -99,24 +99,24 @@ static void pixel_tests(struct test *t, int reps, int sets, enum target target)
int blue = rand() % 0xff;
int alpha = rand() % 0xff;
- fill_rect(&t->real, tt.picture, PictOpSrc,
+ fill_rect(&t->out, tt.picture, PictOpSrc,
x, y, 1, 1,
0, 0, MASK_NONE,
red, green, blue, alpha);
pixels[r].x = x;
pixels[r].y = y;
- cells[y*t->real.width+x] = color(red, green, blue, alpha);
+ cells[y*t->out.width+x] = color(red, green, blue, alpha);
}
- test_init_image(&image, &t->real.shm, tt.format, 1, 1);
+ test_init_image(&image, &t->out.shm, tt.format, 1, 1);
for (r = 0; r < reps; r++) {
uint32_t result;
uint32_t x = pixels[r].x;
uint32_t y = pixels[r].y;
- XShmGetImage(t->real.dpy, tt.draw, &image,
+ XShmGetImage(t->out.dpy, tt.draw, &image,
x, y, AllPlanes);
result = *(uint32_t *)image.data;
@@ -134,7 +134,7 @@ static void pixel_tests(struct test *t, int reps, int sets, enum target target)
}
printf("passed [%d iterations x %d]\n", reps, sets);
- test_target_destroy_render(&t->real, &tt);
+ test_target_destroy_render(&t->out, &tt);
free(pixels);
free(cells);
@@ -151,16 +151,16 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
{
struct test_target tt;
XImage image;
- uint32_t *cells = calloc(sizeof(uint32_t), t->real.width*t->real.height);
+ uint32_t *cells = calloc(sizeof(uint32_t), t->out.width*t->out.height);
int r, s, x, y;
printf("Testing area sets (%s): ", test_target_name(target));
fflush(stdout);
- test_target_create_render(&t->real, target, &tt);
- clear(&t->real, &tt);
+ test_target_create_render(&t->out, target, &tt);
+ clear(&t->out, &tt);
- test_init_image(&image, &t->real.shm, tt.format, tt.width, tt.height);
+ test_init_image(&image, &t->out.shm, tt.format, tt.width, tt.height);
for (s = 0; s < sets; s++) {
for (r = 0; r < reps; r++) {
@@ -174,7 +174,7 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
x = rand() % (2*tt.width) - tt.width;
y = rand() % (2*tt.height) - tt.height;
- fill_rect(&t->real, tt.picture, PictOpSrc,
+ fill_rect(&t->out, tt.picture, PictOpSrc,
x, y, w, h,
0, 0, MASK_NONE,
red, green, blue, alpha);
@@ -197,7 +197,7 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
color(red, green, blue, alpha));
}
- XShmGetImage(t->real.dpy, tt.draw, &image, 0, 0, AllPlanes);
+ XShmGetImage(t->out.dpy, tt.draw, &image, 0, 0, AllPlanes);
for (y = 0; y < tt.height; y++) {
for (x = 0; x < tt.width; x++) {
@@ -221,7 +221,7 @@ static void area_tests(struct test *t, int reps, int sets, enum target target)
printf("passed [%d iterations x %d]\n", reps, sets);
- test_target_destroy_render(&t->real, &tt);
+ test_target_destroy_render(&t->out, &tt);
free(cells);
}
@@ -231,32 +231,32 @@ static void rect_tests(struct test *t,
int reps, int sets,
enum target target)
{
- struct test_target real, ref;
+ struct test_target out, ref;
int r, s;
printf("Testing area fills (offset %dx%d, mask %s) (%s): ",
dx, dy, mask_name(mask), test_target_name(target));
fflush(stdout);
- test_target_create_render(&t->real, target, &real);
- clear(&t->real, &real);
+ test_target_create_render(&t->out, target, &out);
+ clear(&t->out, &out);
test_target_create_render(&t->ref, target, &ref);
clear(&t->ref, &ref);
for (s = 0; s < sets; s++) {
for (r = 0; r < reps; r++) {
- int x = rand() % (2*real.width) - real.width;
- int y = rand() % (2*real.height) - real.height;
- int w = rand() % real.width;
- int h = rand() % real.height;
+ int x = rand() % (2*out.width) - out.width;
+ int y = rand() % (2*out.height) - out.height;
+ int w = rand() % out.width;
+ int h = rand() % out.height;
int op = ops[rand() % sizeof(ops)];
int red = rand() % 0xff;
int green = rand() % 0xff;
int blue = rand() % 0xff;
int alpha = rand() % 0xff;
- fill_rect(&t->real, real.picture, op,
+ fill_rect(&t->out, out.picture, op,
x, y, w, h, dx, dy, mask,
red, green, blue, alpha);
fill_rect(&t->ref, ref.picture, op,
@@ -265,15 +265,15 @@ static void rect_tests(struct test *t,
}
test_compare(t,
- real.draw, real.format,
+ out.draw, out.format,
ref.draw, ref.format,
- 0, 0, real.width, real.height,
+ 0, 0, out.width, out.height,
"");
}
printf("passed [%d iterations x %d]\n", reps, sets);
- test_target_destroy_render(&t->real, &real);
+ test_target_destroy_render(&t->out, &out);
test_target_destroy_render(&t->ref, &ref);
}
@@ -331,7 +331,7 @@ static void trap_tests(struct test *t,
int reps, int sets,
enum target target)
{
- struct test_target real, ref;
+ struct test_target out, ref;
XTrapezoid *traps;
int max_traps = 65536;
int r, s, n;
@@ -346,8 +346,8 @@ static void trap_tests(struct test *t,
test_target_name(target));
fflush(stdout);
- test_target_create_render(&t->real, target, &real);
- clear(&t->real, &real);
+ test_target_create_render(&t->out, target, &out);
+ clear(&t->out, &out);
test_target_create_render(&t->ref, target, &ref);
clear(&t->ref, &ref);
@@ -365,20 +365,20 @@ static void trap_tests(struct test *t,
for (n = 0; n < num_traps; n++)
random_trapezoid(&traps[n], 0,
- 0, 0, real.width, real.height);
+ 0, 0, out.width, out.height);
render_color.red = red * alpha;
render_color.green = green * alpha;
render_color.blue = blue * alpha;
render_color.alpha = alpha << 8;
- src = XRenderCreateSolidFill(t->real.dpy,
+ src = XRenderCreateSolidFill(t->out.dpy,
&render_color);
- XRenderCompositeTrapezoids(t->real.dpy,
- op, src, real.picture,
- mask_format(t->real.dpy, mask),
+ XRenderCompositeTrapezoids(t->out.dpy,
+ op, src, out.picture,
+ mask_format(t->out.dpy, mask),
0, 0, traps, num_traps);
- XRenderFreePicture(t->real.dpy, src);
+ XRenderFreePicture(t->out.dpy, src);
src = XRenderCreateSolidFill(t->ref.dpy,
&render_color);
@@ -390,15 +390,15 @@ static void trap_tests(struct test *t,
}
test_compare(t,
- real.draw, real.format,
+ out.draw, out.format,
ref.draw, ref.format,
- 0, 0, real.width, real.height,
+ 0, 0, out.width, out.height,
"");
}
printf("passed [%d iterations x %d]\n", reps, sets);
- test_target_destroy_render(&t->real, &real);
+ test_target_destroy_render(&t->out, &out);
test_target_destroy_render(&t->ref, &ref);
free(traps);
}