mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 06:28:01 +02:00
[perf] Add another variation on the many-rectangles case
This variation aims to show the difference between calling fill once per-rectangle, or once for all rectangles.
This commit is contained in:
parent
ff5d37a8ad
commit
706f6de68d
1 changed files with 20 additions and 0 deletions
|
|
@ -59,6 +59,25 @@ do_rectangles (cairo_t *cr, int width, int height)
|
|||
return cairo_perf_timer_elapsed ();
|
||||
}
|
||||
|
||||
static cairo_perf_ticks_t
|
||||
do_rectangles_once (cairo_t *cr, int width, int height)
|
||||
{
|
||||
int i;
|
||||
|
||||
cairo_perf_timer_start ();
|
||||
|
||||
for (i = 0; i < RECTANGLE_COUNT; i++)
|
||||
{
|
||||
cairo_rectangle (cr, rects[i].x, rects[i].y,
|
||||
rects[i].width, rects[i].height);
|
||||
}
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_perf_timer_stop ();
|
||||
|
||||
return cairo_perf_timer_elapsed ();
|
||||
}
|
||||
|
||||
static cairo_perf_ticks_t
|
||||
do_rectangle (cairo_t *cr, int width, int height)
|
||||
{
|
||||
|
|
@ -88,4 +107,5 @@ rectangles (cairo_perf_t *perf, cairo_t *cr, int width, int height)
|
|||
|
||||
MODE (perf, "one-rectangle", do_rectangle);
|
||||
MODE (perf, "rectangles", do_rectangles);
|
||||
MODE (perf, "rectangles-once", do_rectangles_once);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue