mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-20 07:00:08 +01:00
test: Use ARRAY_LENGTH macro
This commit is contained in:
parent
ae608035c7
commit
7edc5a8844
3 changed files with 3 additions and 4 deletions
|
|
@ -56,7 +56,6 @@ static const struct spline {
|
||||||
{ 1, 0, 0, 1 },
|
{ 1, 0, 0, 1 },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#define NUM_SPLINES (sizeof(splines)/sizeof(splines[0]))
|
|
||||||
|
|
||||||
static cairo_test_status_t
|
static cairo_test_status_t
|
||||||
draw (cairo_t *cr, int width, int height)
|
draw (cairo_t *cr, int width, int height)
|
||||||
|
|
@ -68,7 +67,7 @@ draw (cairo_t *cr, int width, int height)
|
||||||
|
|
||||||
cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
|
cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
|
||||||
|
|
||||||
for (n = 0; n < NUM_SPLINES; n++) {
|
for (n = 0; n < ARRAY_LENGTH(splines); n++) {
|
||||||
cairo_set_line_width (cr, splines[n].line_width);
|
cairo_set_line_width (cr, splines[n].line_width);
|
||||||
cairo_set_source_rgba (cr,
|
cairo_set_source_rgba (cr,
|
||||||
splines[n].rgba[0],
|
splines[n].rgba[0],
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ draw (cairo_t *cr, int width, int height)
|
||||||
|
|
||||||
cairo_set_line_width (cr, LINE_WIDTH);
|
cairo_set_line_width (cr, LINE_WIDTH);
|
||||||
|
|
||||||
for (t = 0; t < sizeof(theta)/sizeof (theta[0]); t++) {
|
for (t = 0; t < ARRAY_LENGTH(theta); t++) {
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
cairo_translate (cr, 0, t * (SIZE + PAD) + PAD);
|
cairo_translate (cr, 0, t * (SIZE + PAD) + PAD);
|
||||||
draw_caps_joins (cr, theta[t]);
|
draw_caps_joins (cr, theta[t]);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ draw (cairo_t *cr, int width, int height)
|
||||||
cairo_translate (cr, width/2, height/2);
|
cairo_translate (cr, width/2, height/2);
|
||||||
cairo_scale (cr, .85, .85);
|
cairo_scale (cr, .85, .85);
|
||||||
|
|
||||||
for (i = 0; i < sizeof (tiger_commands)/sizeof(tiger_commands[0]);i++) {
|
for (i = 0; i < ARRAY_LENGTH(tiger_commands); i++) {
|
||||||
const struct command *cmd = &tiger_commands[i];
|
const struct command *cmd = &tiger_commands[i];
|
||||||
switch (cmd->type) {
|
switch (cmd->type) {
|
||||||
case 'm':
|
case 'm':
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue