From 0d10280190c411b18feb569a2248552047d1aa93 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Thu, 31 May 2012 18:28:59 +0000 Subject: We often rgn-diff an area >= the other rgn. now we detect that and return empty We do this when we update our devices in SkCanvas.cpp Review URL: https://codereview.appspot.com/6249073 git-svn-id: http://skia.googlecode.com/svn/trunk@4101 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/RegionBench.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'bench/RegionBench.cpp') diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp index 51d389c751..5541a5c019 100644 --- a/bench/RegionBench.cpp +++ b/bench/RegionBench.cpp @@ -25,6 +25,16 @@ static bool diff_proc(SkRegion& a, SkRegion& b) { return result.op(a, b, SkRegion::kDifference_Op); } +static bool diffrect_proc(SkRegion& a, SkRegion& b) { + SkRegion result; + return result.op(a, b.getBounds(), SkRegion::kDifference_Op); +} + +static bool diffrectbig_proc(SkRegion& a, SkRegion& b) { + SkRegion result; + return result.op(a, a.getBounds(), SkRegion::kDifference_Op); +} + static bool containsrect_proc(SkRegion& a, SkRegion& b) { SkIRect r = a.getBounds(); r.inset(r.width()/4, r.height()/4); @@ -112,10 +122,12 @@ private: static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, union_proc, "union")); } 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, 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 SkBenchmark* gF3(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diffrect_proc, "differencerect")); } +static SkBenchmark* gF4(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diffrectbig_proc, "differencerectbig")); } +static SkBenchmark* gF5(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsrect_proc, "containsrect", 100)); } +static SkBenchmark* gF6(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrgn_proc, "intersectsrgn", 10)); } +static SkBenchmark* gF7(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrect_proc, "intersectsrect", 200)); } +static SkBenchmark* gF8(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsxy_proc, "containsxy")); } static BenchRegistry gR0(gF0); static BenchRegistry gR1(gF1); @@ -124,3 +136,5 @@ static BenchRegistry gR3(gF3); static BenchRegistry gR4(gF4); static BenchRegistry gR5(gF5); static BenchRegistry gR6(gF6); +static BenchRegistry gR7(gF7); +static BenchRegistry gR8(gF8); -- cgit v1.2.3