void tessellate (cairo_perf_t *perf, cairo_t *cr, int width, int height) { 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 long_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "long-lines-uncropped", long_lines_uncropped, NULL); cairo_perf_run (perf, "long-lines-uncropped-once", long_lines_uncropped_once, NULL); cairo_perf_run (perf, "long-lines-cropped", long_lines_cropped, NULL); cairo_perf_run (perf, "long-lines-cropped-once", long_lines_cropped_once, NULL); }
void curve (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_set_source_rgb (cr, 1., 1., 1.); cairo_perf_run (perf, "curve-stroked", do_curve_stroke, NULL); cairo_perf_run (perf, "curve-filled", do_curve_fill, NULL); }
void a1_curve (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_set_source_rgb (cr, 1., 1., 1.); cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); cairo_perf_run (perf, "a1-curve-stroked", do_curve_stroke, NULL); cairo_perf_run (perf, "a1-curve-filled", do_curve_fill, NULL); }
void wide_fills (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "wide-fills-halign", do_wide_fills_ha, NULL); cairo_perf_run (perf, "wide-fills-valign", do_wide_fills_va, NULL); cairo_perf_run (perf, "wide-fills-horizontal", do_wide_fills_h, NULL); cairo_perf_run (perf, "wide-fills-vertical", do_wide_fills_v, NULL); cairo_perf_run (perf, "wide-fills-random", do_wide_fills, NULL); }
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 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 intersections (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "intersections-nz-fill", random_nz, NULL); cairo_perf_run (perf, "intersections-eo-fill", random_eo, NULL); cairo_perf_run (perf, "intersections-nz-curve-fill", random_curve_nz, NULL); cairo_perf_run (perf, "intersections-eo-curve-fill", random_curve_eo, NULL); }
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 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 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 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 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 line (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_set_source_rgb (cr, 1., 1., 1.); cairo_perf_run (perf, "line-hh", horizontal_hair, NULL); cairo_perf_run (perf, "line-hw", horizontal_wide, NULL); cairo_perf_run (perf, "line-nhh", nearly_horizontal_hair, NULL); cairo_perf_run (perf, "line-nhw", nearly_horizontal_wide, NULL); cairo_perf_run (perf, "line-vh", vertical_hair, NULL); cairo_perf_run (perf, "line-vw", vertical_wide, NULL); cairo_perf_run (perf, "line-nvh", nearly_vertical_hair, NULL); cairo_perf_run (perf, "line-nvw", nearly_vertical_wide, NULL); cairo_perf_run (perf, "line-dh", diagonal_hair, NULL); cairo_perf_run (perf, "line-dw", diagonal_wide, NULL); }
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 rectangles (cairo_perf_t *perf, cairo_t *cr, int width, int height) { int i; 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; } cairo_perf_run (perf, "rectangles", do_rectangles); }
void box_outline (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "box-outline-stroke", box_outline_stroke, NULL); cairo_perf_run (perf, "box-outline-fill", box_outline_fill, NULL); cairo_perf_run (perf, "box-outline-alpha-stroke", box_outline_alpha_stroke, NULL); cairo_perf_run (perf, "box-outline-alpha-fill", box_outline_alpha_fill, NULL); cairo_perf_run (perf, "box-outline-aa-stroke", box_outline_aa_stroke, NULL); cairo_perf_run (perf, "box-outline-aa-fill", box_outline_aa_fill, NULL); }
void cairo_perf_cover_sources_and_operators (cairo_perf_t *perf, const char *name, cairo_perf_func_t perf_func) { unsigned int i, j; char *expanded_name; struct { set_source_func_t set_source; const char *name; } sources[] = { { set_source_solid_rgb, "solid_rgb" }, { set_source_solid_rgba, "solid_rgba" }, { set_source_image_surface_rgb, "image_rgb" }, { set_source_image_surface_rgba, "image_rgba" }, { set_source_image_surface_rgba_mag, "image_rgba_mag" }, { set_source_image_surface_rgba_min, "image_rgba_min" }, { set_source_similar_surface_rgb, "similar_rgb" }, { set_source_similar_surface_rgba, "similar_rgba" }, { set_source_similar_surface_rgba_mag, "similar_rgba_mag" }, { set_source_similar_surface_rgba_min, "similar_rgba_min" }, { set_source_linear_rgb, "linear_rgb" }, { set_source_linear_rgba, "linear_rgba" }, { set_source_linear3_rgb, "linear3_rgb" }, { set_source_linear3_rgba, "linear3_rgba" }, { set_source_radial_rgb, "radial_rgb" }, { set_source_radial_rgba, "radial_rgba" } }; struct { cairo_operator_t op; const char *name; } operators[] = { { CAIRO_OPERATOR_OVER, "over" }, { CAIRO_OPERATOR_SOURCE, "source" } }; for (i = 0; i < ARRAY_SIZE (sources); i++) { (sources[i].set_source) (perf->cr, perf->size, perf->size); for (j = 0; j < ARRAY_SIZE (operators); j++) { cairo_set_operator (perf->cr, operators[j].op); xasprintf (&expanded_name, "%s_%s_%s", name, sources[i].name, operators[j].name); cairo_perf_run (perf, expanded_name, perf_func); free (expanded_name); } } }
void glyphs (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_cover_sources_and_operators (perf, "glyphs8mono", do_glyphs8mono, count_glyphs8mono); cairo_perf_cover_sources_and_operators (perf, "glyphs8", do_glyphs8, count_glyphs8); cairo_perf_cover_sources_and_operators (perf, "glyphs8ca", do_glyphs8ca, count_glyphs8ca); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_set_source_rgb (cr, 0, 0, 0); cairo_perf_run (perf, "glyphs8", do_glyphs8, count_glyphs8); cairo_perf_run (perf, "glyphs10", do_glyphs10, count_glyphs10); cairo_perf_run (perf, "glyphs12", do_glyphs12, count_glyphs12); cairo_perf_run (perf, "glyphs16", do_glyphs16, count_glyphs16); cairo_perf_run (perf, "glyphs20", do_glyphs20, count_glyphs20); cairo_perf_run (perf, "glyphs24", do_glyphs24, count_glyphs24); cairo_perf_run (perf, "glyphs32", do_glyphs32, count_glyphs32); cairo_perf_run (perf, "glyphs40", do_glyphs40, count_glyphs40); cairo_perf_run (perf, "glyphs48", do_glyphs48, count_glyphs48); cairo_perf_cover_sources_and_operators (perf, "glyphs48mono", do_glyphs48mono, count_glyphs48mono); cairo_perf_cover_sources_and_operators (perf, "glyphs48", do_glyphs48, count_glyphs48); cairo_perf_cover_sources_and_operators (perf, "glyphs48ca", do_glyphs48ca, count_glyphs48ca); }
void pattern_create_radial (cairo_perf_t *perf, cairo_t *cr, int width, int height) { int i; 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, NULL); }
void subimage_copy (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_surface_t *image; cairo_t *cr2; cairo_set_source_rgb (cr, 0, 0, 1); /* blue */ cairo_paint (cr); image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); cr2 = cairo_create (image); cairo_set_source_rgb (cr2, 1, 0, 0); /* red */ cairo_paint (cr2); cairo_destroy (cr2); cairo_set_source_surface (cr, image, 0, 0); cairo_surface_destroy (image); cairo_perf_run (perf, "subimage_copy", do_subimage_copy); }
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); }
void unaligned_clip (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "unaligned-clip", do_unaligned_clip, NULL); }
void world_map (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "world_map", do_world_map); }
void pythagoras_tree (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "pythagoras_tree", do_pythagoras_tree); }
void spiral (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "spiral-box-nonalign-evenodd-fill", draw_spiral_eo_na_box, NULL); cairo_perf_run (perf, "spiral-box-nonalign-nonzero-fill", draw_spiral_nz_na_box, NULL); cairo_perf_run (perf, "spiral-box-pixalign-evenodd-fill", draw_spiral_eo_pa_box, NULL); cairo_perf_run (perf, "spiral-box-pixalign-nonzero-fill", draw_spiral_nz_pa_box, NULL); cairo_perf_run (perf, "spiral-diag-nonalign-evenodd-fill", draw_spiral_eo_na_di, NULL); cairo_perf_run (perf, "spiral-diag-nonalign-nonzero-fill", draw_spiral_nz_na_di, NULL); cairo_perf_run (perf, "spiral-diag-pixalign-evenodd-fill", draw_spiral_eo_pa_di, NULL); cairo_perf_run (perf, "spiral-diag-pixalign-nonzero-fill", draw_spiral_nz_pa_di, NULL); cairo_perf_run (perf, "spiral-rect-nonalign-evenodd-fill", draw_spiral_eo_na_re, NULL); cairo_perf_run (perf, "spiral-rect-nonalign-nonzero-fill", draw_spiral_nz_na_re, NULL); cairo_perf_run (perf, "spiral-rect-pixalign-evenodd-fill", draw_spiral_eo_pa_re, NULL); cairo_perf_run (perf, "spiral-rect-pixalign-nonzero-fill", draw_spiral_nz_pa_re, NULL); cairo_perf_run (perf, "spiral-nonalign-stroke", draw_spiral_stroke_na, NULL); cairo_perf_run (perf, "spiral-pixalign-stroke", draw_spiral_stroke_pa, NULL); }
void sierpinski (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "sierpinski", draw, NULL); }
void long_dashed_lines (cairo_perf_t *perf, cairo_t *cr, int width, int height) { cairo_perf_run (perf, "long-dashed-lines", do_long_dashed_lines, NULL); }