From 4b4f86d34de000e38cc03bce5995a132e13e3c8c Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Wed, 2 May 2012 17:20:02 +0000 Subject: distinguish intersects-rect from intersects-rgn git-svn-id: http://skia.googlecode.com/svn/trunk@3822 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/RegionBench.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'bench/RegionBench.cpp') diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp index a520e4245d..b984b62f55 100644 --- a/bench/RegionBench.cpp +++ b/bench/RegionBench.cpp @@ -35,10 +35,16 @@ static bool containsrect_proc(SkRegion& a, SkRegion& b) { return b.contains(r); } -static bool sects_proc(SkRegion& a, SkRegion& b) { +static bool sectsrgn_proc(SkRegion& a, SkRegion& b) { return a.intersects(b); } +static bool sectsrect_proc(SkRegion& a, SkRegion& b) { + SkIRect r = a.getBounds(); + r.inset(r.width()/4, r.height()/4); + (void)a.intersects(r); +} + static bool containsxy_proc(SkRegion& a, SkRegion& b) { const SkIRect& r = a.getBounds(); const int dx = r.width() / 8; @@ -107,8 +113,9 @@ static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, uni static SkBenchmark* gF1(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sect_proc, "intersect")); } static SkBenchmark* gF2(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diff_proc, "difference")); } static SkBenchmark* gF3(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsrect_proc, "containsrect", 100)); } -static SkBenchmark* gF4(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sects_proc, "intersects", 10)); } -static SkBenchmark* gF5(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsxy_proc, "containsxy")); } +static SkBenchmark* gF4(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrgn_proc, "intersectsrgn", 10)); } +static SkBenchmark* gF5(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrect_proc, "intersectsrect", 200)); } +static SkBenchmark* gF6(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsxy_proc, "containsxy")); } static BenchRegistry gR0(gF0); static BenchRegistry gR1(gF1); @@ -116,3 +123,4 @@ static BenchRegistry gR2(gF2); static BenchRegistry gR3(gF3); static BenchRegistry gR4(gF4); static BenchRegistry gR5(gF5); +static BenchRegistry gR6(gF6); -- cgit v1.2.3