1
#define WIDTH 1350
2
#define HEIGHT 900
3

            
4
#include "cairo-perf.h"
5

            
6
static cairo_time_t
7
do_twin (cairo_t *cr,
8
	 int width,
9
	 int height,
10
	 int loops)
11
{
12
    int i, j, h;
13
    unsigned char s[2] = {0, 0};
14

            
15
    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
16
    cairo_paint (cr);
17
    cairo_set_source_rgb (cr, 0, 0, 0);
18

            
19
    cairo_select_font_face (cr,
20
			    "@cairo:",
21
			    CAIRO_FONT_SLANT_NORMAL,
22
			    CAIRO_FONT_WEIGHT_NORMAL);
23

            
24
    cairo_perf_timer_start ();
25

            
26
    while (loops--) {
27
	h = 2;
28
	for (i = 8; i < 48; i >= 24 ? i+=3 : i++) {
29
	    cairo_set_font_size (cr, i);
30
	    for (j = 33; j < 128; j++) {
31
		if (j == 33 || (j == 80 && i > 24)) {
32
		    h += i + 2;
33
		    cairo_move_to (cr, 10, h);
34
		}
35
		s[0] = j;
36
		cairo_text_path (cr, (const char *) s);
37
	    }
38
	}
39
	cairo_fill (cr);
40
    }
41

            
42
    cairo_perf_timer_stop ();
43
    return cairo_perf_timer_elapsed ();
44
}
45

            
46
cairo_bool_t
47
twin_enabled (cairo_perf_t *perf)
48
{
49
    return cairo_perf_can_run (perf, "twin", NULL);
50
}
51

            
52
void
53
twin (cairo_perf_t *perf,
54
      cairo_t      *cr,
55
      int           width,
56
      int           height)
57
{
58
    cairo_perf_run (perf, "twin", do_twin, NULL);
59
}