diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-03-16 16:48:18 +0100 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-03-17 17:45:57 +0100 |
commit | 75fea162d985bea622afa59771fb2d07f5241d1b (patch) | |
tree | 5876692cd2ba574481210fae292eaf7f06005028 /test/mask.c | |
parent | 4ef32a36ba1e457e8dd6244a6483866d33477aac (diff) | |
download | cairo-75fea162d985bea622afa59771fb2d07f5241d1b.tar.gz |
test: Cleanup macros
The ARRAY_LENGTH macro is used by many tests, although sometimes it is
named ARRAY_SIZE. Define it just once in cairo-test.h and reuse it.
In a similar way, MAX() and MIN() are currently defined in some
specific tests, while they could be reused.
Diffstat (limited to 'test/mask.c')
-rw-r--r-- | test/mask.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/mask.c b/test/mask.c index 451054e38..cc722d384 100644 --- a/test/mask.c +++ b/test/mask.c @@ -180,9 +180,8 @@ static void (* const clip_funcs[])(cairo_t *cr, int x, int y) = { clip_circle, }; -#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) -#define IMAGE_WIDTH (ARRAY_SIZE (pattern_funcs) * (WIDTH + PAD) + PAD) -#define IMAGE_HEIGHT (ARRAY_SIZE (mask_funcs) * ARRAY_SIZE (clip_funcs) * (HEIGHT + PAD) + PAD) +#define IMAGE_WIDTH (ARRAY_LENGTH (pattern_funcs) * (WIDTH + PAD) + PAD) +#define IMAGE_HEIGHT (ARRAY_LENGTH (mask_funcs) * ARRAY_LENGTH (clip_funcs) * (HEIGHT + PAD) + PAD) static cairo_test_status_t draw (cairo_t *cr, int width, int height) @@ -201,11 +200,11 @@ draw (cairo_t *cr, int width, int height) cr2 = cairo_create (tmp_surface); cairo_surface_destroy (tmp_surface); - for (k = 0; k < ARRAY_SIZE (clip_funcs); k++) { - for (j = 0; j < ARRAY_SIZE (mask_funcs); j++) { - for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) { + for (k = 0; k < ARRAY_LENGTH (clip_funcs); k++) { + for (j = 0; j < ARRAY_LENGTH (mask_funcs); j++) { + for (i = 0; i < ARRAY_LENGTH (pattern_funcs); i++) { int x = i * (WIDTH + PAD) + PAD; - int y = (ARRAY_SIZE (mask_funcs) * k + j) * (HEIGHT + PAD) + PAD; + int y = (ARRAY_LENGTH (mask_funcs) * k + j) * (HEIGHT + PAD) + PAD; /* Clear intermediate surface we are going to be drawing onto */ cairo_save (cr2); |