static int cairo_perf_trace_dir (cairo_perf_t *perf, const cairo_boilerplate_target_t *target, const char *dirname) { DIR *dir; struct dirent *de; int num_traces = 0; cairo_bool_t force; cairo_bool_t is_explicit; dir = opendir (dirname); if (dir == NULL) return 0; force = FALSE; if (cairo_perf_can_run (perf, dirname, &is_explicit)) force = is_explicit; while ((de = readdir (dir)) != NULL) { char *trace; struct stat st; if (de->d_name[0] == '.') continue; xasprintf (&trace, "%s/%s", dirname, de->d_name); if (stat (trace, &st) != 0) goto next; if (S_ISDIR(st.st_mode)) { num_traces += cairo_perf_trace_dir (perf, target, trace); } else { const char *dot; dot = strrchr (de->d_name, '.'); if (dot == NULL) goto next; if (strcmp (dot, ".trace")) goto next; num_traces++; if (!force && ! cairo_perf_can_run (perf, de->d_name, NULL)) goto next; cairo_perf_trace (perf, target, trace); } next: free (trace); } closedir (dir); return num_traces; }
void long_dashed_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "long-dashed-lines", NULL)) return; cairo_perf_run (perf, "long-dashed-lines", do_long_dashed_lines); }
void pythagoras_tree (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "pythagoras_tree")) return; cairo_perf_run (perf, "pythagoras_tree", do_pythagoras_tree); }
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); }
void text (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "text", NULL)) return; cairo_perf_cover_sources_and_operators (perf, "text", do_text, NULL); }
void glyphs (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "glyphs", NULL)) return; cairo_perf_cover_sources_and_operators (perf, "glyphs", do_glyphs); }
void long_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "long-lines")) return; cairo_perf_run (perf, "long-lines-uncropped", long_lines_uncropped); cairo_perf_run (perf, "long-lines-cropped", long_lines_cropped); }
void box_outline (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "box-outline", NULL)) return; cairo_perf_run (perf, "box-outline-stroke", box_outline_stroke); cairo_perf_run (perf, "box-outline-fill", box_outline_fill); }
void paint_with_alpha (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "paint-with-alpha", NULL)) return; cairo_perf_cover_sources_and_operators (perf, "paint-with-alpha", do_paint_with_alpha); }
void zrusin (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "zrusin", NULL)) return; cairo_perf_run (perf, "zrusin-another-tessellate", zrusin_another_tessellate); cairo_perf_run (perf, "zrusin-another-fill", zrusin_another_fill); }
void tessellate (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "tessellate", NULL)) return; cairo_perf_run (perf, "tessellate-16", tessellate_16); cairo_perf_run (perf, "tessellate-64", tessellate_64); cairo_perf_run (perf, "tessellate-256", tessellate_256); }
void fill (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "fill", NULL)) return; cairo_perf_cover_sources_and_operators (perf, "fill", do_fill); cairo_perf_cover_sources_and_operators (perf, "fill-annuli", do_fill_annuli); cairo_perf_cover_sources_and_operators (perf, "fill-eo-noaa", do_fill_eo_noaa); }
void twin (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "twin", NULL)) return; cairo_perf_run (perf, "twin", do_twin); }
void mosaic (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "mosaic", NULL)) return; cairo_perf_run (perf, "mosaic-fill-curves", mosaic_fill_curves, NULL); cairo_perf_run (perf, "mosaic-fill-lines", mosaic_fill_lines, NULL); cairo_perf_run (perf, "mosaic-tessellate-curves", mosaic_tessellate_curves, NULL); cairo_perf_run (perf, "mosaic-tessellate-lines", mosaic_tessellate_lines, NULL); }
void dragon (cairo_perf_t *perf, cairo_t *cr, int width, int height) { if (! cairo_perf_can_run (perf, "dragon", NULL)) return; cairo_perf_run (perf, "dragon-solid", do_dragon_solid, NULL); cairo_perf_run (perf, "dragon-solid-aligned-clip", do_dragon_solid_aligned_clip, NULL); cairo_perf_run (perf, "dragon-solid-unaligned-clip", do_dragon_solid_unaligned_clip, NULL); cairo_perf_run (perf, "dragon-solid-circle-clip", do_dragon_solid_circle_clip, NULL); cairo_perf_run (perf, "dragon", do_dragon, NULL); }
void rectangles (cairo_perf_t *perf, cairo_t *cr, int width, int height) { int i; if (! cairo_perf_can_run (perf, "rectangles", NULL)) return; srand (8478232); for (i = 0; i < RECTANGLE_COUNT; i++) { rects[i].x = rand () % width; rects[i].y = rand () % height; rects[i].width = (rand () % (width / 10)) + 1; rects[i].height = (rand () % (height / 10)) + 1; } MODE (perf, "one-rectangle", do_rectangle); MODE (perf, "rectangles", do_rectangles); MODE (perf, "rectangles-once", do_rectangles_once); }
void pattern_create_radial (cairo_perf_t *perf, cairo_t *cr, int width, int height) { int i; if (! cairo_perf_can_run (perf, "pattern-create-radial", NULL)) return; srand (time (0)); for (i = 0; i < RADIALS_COUNT; i++) { radials[i].cx0 = generate_double_in_range (-50000.0, 50000.0); radials[i].cy0 = generate_double_in_range (-50000.0, 50000.0); radials[i].radius0 = generate_double_in_range (0.0, 1000.0); radials[i].cx1 = generate_double_in_range (-50000.0, 50000.0); radials[i].cy1 = generate_double_in_range (-50000.0, 50000.0); radials[i].radius1 = generate_double_in_range (0.0, 1000.0); } cairo_perf_run (perf, "pattern-create-radial", do_pattern_create_radial); }
void composite_checker (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_surface_t *image; if (! cairo_perf_can_run (perf, "composite-checker")) return; /* Create the checker pattern. We don't actually need to draw * anything on it since that wouldn't affect performance. */ image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, PAT_SIZE, PAT_SIZE); checkerboard = cairo_pattern_create_for_surface (image); cairo_pattern_set_filter (checkerboard, CAIRO_FILTER_NEAREST); cairo_pattern_set_extend (checkerboard, CAIRO_EXTEND_REPEAT); cairo_surface_destroy (image); /* Create the image source pattern. Again we use the NEAREST * filtering which should be fastest. */ image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, SRC_SIZE, SRC_SIZE); src_pattern = cairo_pattern_create_for_surface (image); cairo_pattern_set_filter (src_pattern, CAIRO_FILTER_NEAREST); cairo_surface_destroy (image); cairo_perf_run (perf, "composite-checker", do_composite_checker); cairo_pattern_destroy (checkerboard); cairo_pattern_destroy (src_pattern); }
cairo_bool_t intersections_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "intersections", NULL); }
cairo_bool_t text_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "text", NULL); }
cairo_bool_t line_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "line", NULL); }
cairo_bool_t unaligned_clip_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "unaligned-clip", NULL); }
cairo_bool_t a1_curve_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "a1-curve", NULL); }
cairo_bool_t rounded_rectangles_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "rounded-rectangles", NULL); }
cairo_bool_t stroke_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "stroke", NULL); }
cairo_bool_t wide_fills_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "wide-fills", NULL); }
cairo_bool_t long_lines_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "long-lines", NULL); }
cairo_bool_t pattern_create_radial_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "pattern-create-radial", NULL); }
cairo_bool_t sierpinski_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "sierpinski", NULL); }
cairo_bool_t glyphs_enabled (cairo_perf_t *perf) { return cairo_perf_can_run (perf, "glyphs", NULL); }