diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-03 15:57:18 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-05 09:48:14 +0100 |
commit | 1e8d56ceeb7ca3114651ec7c98a69510c9dcc4ff (patch) | |
tree | b7c7251b7e573baccabc214250e38f76cac0e114 /perf | |
parent | 5ab1eced5f82c9e54f171afe5bf9a2b72c778e71 (diff) |
perf: Add stroke/fill variants to world-map
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'perf')
-rw-r--r-- | perf/micro/world-map.c | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/perf/micro/world-map.c b/perf/micro/world-map.c index 42b8da516..4f9a88043 100644 --- a/perf/micro/world-map.c +++ b/perf/micro/world-map.c @@ -48,8 +48,13 @@ typedef struct _wm_element { #include "world-map.h" +enum { + STROKE = 1, + FILL = 2, +}; + static cairo_perf_ticks_t -do_world_map (cairo_t *cr, int width, int height, int loops) +do_world_map (cairo_t *cr, int width, int height, int loops, int mode) { const wm_element_t *e; double cx, cy; @@ -68,10 +73,15 @@ do_world_map (cairo_t *cr, int width, int height, int loops) switch (e->type) { case WM_NEW_PATH: case WM_END: - cairo_set_source_rgb (cr, .75, .75, .75); /* silver */ - cairo_fill_preserve (cr); - cairo_set_source_rgb (cr, .50, .50, .50); /* gray */ - cairo_stroke (cr); + if (mode & FILL) { + cairo_set_source_rgb (cr, .75, .75, .75); /* silver */ + cairo_fill_preserve (cr); + } + if (mode & STROKE) { + cairo_set_source_rgb (cr, .50, .50, .50); /* gray */ + cairo_stroke (cr); + } + cairo_new_path (cr); cairo_move_to (cr, e->x, e->y); break; case WM_MOVE_TO: @@ -106,11 +116,31 @@ do_world_map (cairo_t *cr, int width, int height, int loops) return cairo_perf_timer_elapsed (); } +static cairo_perf_ticks_t +do_world_map_stroke (cairo_t *cr, int width, int height, int loops) +{ + return do_world_map (cr, width, height, loops, STROKE); +} + +static cairo_perf_ticks_t +do_world_map_fill (cairo_t *cr, int width, int height, int loops) +{ + return do_world_map (cr, width, height, loops, FILL); +} + +static cairo_perf_ticks_t +do_world_map_both (cairo_t *cr, int width, int height, int loops) +{ + return do_world_map (cr, width, height, loops, FILL | STROKE); +} + void world_map (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "world-map", NULL)) return; - cairo_perf_run (perf, "world-map", do_world_map, NULL); + cairo_perf_run (perf, "world-map-stroke", do_world_map_stroke, NULL); + cairo_perf_run (perf, "world-map-fill", do_world_map_fill, NULL); + cairo_perf_run (perf, "world-map", do_world_map_both, NULL); } |