summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-tests/stroke.cpp
blob: 2ae95aee876a25c347017ce0ebe59e43064223bf (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
#include <stdio.h>
#include <stdlib.h>
#include <cairo.h>

#include "caskbench.h"

int
ca_setup_stroke(caskbench_context_t *ctx)
{
  return 1;
}

void
ca_teardown_stroke(void)
{
}

int
ca_test_stroke(caskbench_context_t *ctx)
{
  int i, x, w, prev_w;
  x = 0;
  prev_w = 0;
  for (i=0; i<32; i++) {
    randomize_color (ctx->cr);
    w = (32.0*rand())/RAND_MAX + 1;
    x += 4 + (prev_w + w)/2.0;
    cairo_move_to (ctx->cr, x, 10);
    cairo_line_to (ctx->cr, x, 70);
    cairo_set_line_width (ctx->cr, w);
    cairo_stroke (ctx->cr);
    prev_w = w;
  }
  return 1;
}