diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-08 22:39:48 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-22 16:38:12 +0100 |
commit | 09651a1c1a4856607423e9b06c1f7c397ba4f304 (patch) | |
tree | 8c73f8d2b15df60b309157dec01896520d9fa77b /perf | |
parent | 954ebacb71071c53c4e4092b469417f01478bc2d (diff) |
Twin perf case
Diffstat (limited to 'perf')
-rw-r--r-- | perf/Makefile.am | 3 | ||||
-rw-r--r-- | perf/cairo-perf.c | 1 | ||||
-rw-r--r-- | perf/cairo-perf.h | 1 | ||||
-rw-r--r-- | perf/twin.c | 50 |
4 files changed, 54 insertions, 1 deletions
diff --git a/perf/Makefile.am b/perf/Makefile.am index 512e6d11..daec8e4e 100644 --- a/perf/Makefile.am +++ b/perf/Makefile.am @@ -34,8 +34,9 @@ cairo_perf_SOURCES = \ stroke.c \ subimage_copy.c \ tessellate.c \ - unaligned-clip.c \ text.c \ + twin.c \ + unaligned-clip.c \ world-map.c \ world-map.h \ zrusin.c \ diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c index 613d15cf..a6d59a57 100644 --- a/perf/cairo-perf.c +++ b/perf/cairo-perf.c @@ -458,5 +458,6 @@ const cairo_perf_case_t perf_cases[] = { { rounded_rectangles, 512, 512}, { long_dashed_lines, 512, 512}, { composite_checker, 16, 512}, + { twin, 800, 800}, { NULL } }; diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h index 57fe85f1..0cedb691 100644 --- a/perf/cairo-perf.h +++ b/perf/cairo-perf.h @@ -172,5 +172,6 @@ CAIRO_PERF_DECL (rectangles); CAIRO_PERF_DECL (rounded_rectangles); CAIRO_PERF_DECL (long_dashed_lines); CAIRO_PERF_DECL (composite_checker); +CAIRO_PERF_DECL (twin); #endif diff --git a/perf/twin.c b/perf/twin.c new file mode 100644 index 00000000..d81c2af0 --- /dev/null +++ b/perf/twin.c @@ -0,0 +1,50 @@ +#define WIDTH 1350 +#define HEIGHT 900 + +#include "cairo-perf.h" + +static cairo_perf_ticks_t +do_twin (cairo_t *cr, + int width, + int height) +{ + 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_perf_timer_start (); + + cairo_select_font_face (cr, + "cairo", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); + + 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); + } + } + cairo_fill (cr); + + cairo_perf_timer_stop (); + return cairo_perf_timer_elapsed (); +} + +void +twin (cairo_perf_t *perf, + cairo_t *cr, + int width, + int height) +{ + cairo_perf_run (perf, "twin", do_twin); +} |