2008-10-30 19:14:07 +00:00
|
|
|
#define WIDTH 1350
|
|
|
|
|
#define HEIGHT 900
|
|
|
|
|
|
|
|
|
|
#include "cairo-perf.h"
|
|
|
|
|
|
|
|
|
|
static cairo_perf_ticks_t
|
|
|
|
|
do_twin (cairo_t *cr,
|
|
|
|
|
int width,
|
2009-08-03 22:23:19 +01:00
|
|
|
int height,
|
|
|
|
|
int loops)
|
2008-10-30 19:14:07 +00:00
|
|
|
{
|
|
|
|
|
int i, j, h;
|
|
|
|
|
unsigned char s[2] = {0, 0};
|
|
|
|
|
|
|
|
|
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
cairo_select_font_face (cr,
|
2008-12-20 15:34:41 +00:00
|
|
|
"@cairo:",
|
2008-10-30 19:14:07 +00:00
|
|
|
CAIRO_FONT_SLANT_NORMAL,
|
|
|
|
|
CAIRO_FONT_WEIGHT_NORMAL);
|
|
|
|
|
|
2009-08-03 22:23:19 +01:00
|
|
|
cairo_perf_timer_start ();
|
|
|
|
|
|
|
|
|
|
while (loops--) {
|
|
|
|
|
h = 2;
|
|
|
|
|
for (i = 8; i < 48; i >= 24 ? i+=3 : i++) {
|
|
|
|
|
cairo_set_font_size (cr, i);
|
|
|
|
|
for (j = 33; j < 128; j++) {
|
|
|
|
|
if (j == 33 || (j == 80 && i > 24)) {
|
|
|
|
|
h += i + 2;
|
|
|
|
|
cairo_move_to (cr, 10, h);
|
|
|
|
|
}
|
|
|
|
|
s[0] = j;
|
|
|
|
|
cairo_text_path (cr, (const char *) s);
|
2008-10-30 19:14:07 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-08-03 22:23:19 +01:00
|
|
|
cairo_fill (cr);
|
2008-10-30 19:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cairo_perf_timer_stop ();
|
|
|
|
|
return cairo_perf_timer_elapsed ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
twin (cairo_perf_t *perf,
|
|
|
|
|
cairo_t *cr,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
|
|
|
|
{
|
2009-02-06 20:11:17 +00:00
|
|
|
if (! cairo_perf_can_run (perf, "twin"))
|
|
|
|
|
return;
|
|
|
|
|
|
2008-10-30 19:14:07 +00:00
|
|
|
cairo_perf_run (perf, "twin", do_twin);
|
|
|
|
|
}
|