summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-13 15:52:06 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-26 23:51:42 +0100
commitfddfe4973f5b49f280734ee7141ab72451cf94d2 (patch)
tree762005e7814673c8a7dff2d6eea084f1fb7d6834 /perf
parent8b3be26c7be0747378792e3a454e500d290c3982 (diff)
[perf] Add clipped modes to dragon
Investigate the performance hit for unclipped/aligned/unaligned/masked modes with a reasonably complex geometry.
Diffstat (limited to 'perf')
-rw-r--r--perf/dragon.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/perf/dragon.c b/perf/dragon.c
index 366b63c2..a145f781 100644
--- a/perf/dragon.c
+++ b/perf/dragon.c
@@ -202,6 +202,38 @@ do_dragon_solid (cairo_t *cr, int width, int height, int loops)
return cairo_perf_timer_elapsed ();
}
+static cairo_perf_ticks_t
+do_dragon_solid_aligned_clip (cairo_t *cr, int width, int height, int loops)
+{
+ cairo_reset_clip (cr);
+ cairo_rectangle (cr, 10, 10, width/2 + 10, height/2 + 10);
+ cairo_rectangle (cr, width/2-20, height/2-20, width/2 + 10, height/2 + 10);
+ cairo_clip (cr);
+
+ return do_dragon_solid (cr, width, height, loops);
+}
+
+static cairo_perf_ticks_t
+do_dragon_solid_unaligned_clip (cairo_t *cr, int width, int height, int loops)
+{
+ cairo_reset_clip (cr);
+ cairo_rectangle (cr, 10.5, 10.5, width/2 + 10, height/2 + 10);
+ cairo_rectangle (cr, width/2-20, height/2-20, width/2 + 9.5, height/2 + 9.5);
+ cairo_clip (cr);
+
+ return do_dragon_solid (cr, width, height, loops);
+}
+
+static cairo_perf_ticks_t
+do_dragon_solid_circle_clip (cairo_t *cr, int width, int height, int loops)
+{
+ cairo_reset_clip (cr);
+ cairo_arc (cr, width/2., height/2., MIN (width, height)/2. - 10, 0, 2 * M_PI);
+ cairo_clip (cr);
+
+ return do_dragon_solid (cr, width, height, loops);
+}
+
void
dragon (cairo_perf_t *perf, cairo_t *cr, int width, int height)
{
@@ -209,5 +241,8 @@ dragon (cairo_perf_t *perf, cairo_t *cr, int width, int height)
return;
cairo_perf_run (perf, "dragon-solid", do_dragon_solid);
+ cairo_perf_run (perf, "dragon-solid-aligned-clip", do_dragon_solid_aligned_clip);
+ cairo_perf_run (perf, "dragon-solid-unaligned-clip", do_dragon_solid_unaligned_clip);
+ cairo_perf_run (perf, "dragon-solid-circle-clip", do_dragon_solid_circle_clip);
cairo_perf_run (perf, "dragon", do_dragon);
}