OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
10 #include "SkRegion.h" | 10 #include "SkRegion.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 fName.printf("region_contains_%s", name); | 38 fName.printf("region_contains_%s", name); |
39 | 39 |
40 SkRandom rand; | 40 SkRandom rand; |
41 for (int i = 0; i < COUNT; i++) { | 41 for (int i = 0; i < COUNT; i++) { |
42 fA.op(randrect(rand, i), SkRegion::kXOR_Op); | 42 fA.op(randrect(rand, i), SkRegion::kXOR_Op); |
43 } | 43 } |
44 | 44 |
45 fB.setRect(0, 0, H, W); | 45 fB.setRect(0, 0, H, W); |
46 } | 46 } |
47 | 47 |
48 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 48 bool isSuitableFor(Backend backend) SK_OVERRIDE { |
49 return backend == kNonRendering_Backend; | 49 return backend == kNonRendering_Backend; |
50 } | 50 } |
51 | 51 |
52 protected: | 52 protected: |
53 virtual const char* onGetName() SK_OVERRIDE { return fName.c_str(); } | 53 const char* onGetName() SK_OVERRIDE { return fName.c_str(); } |
54 | 54 |
55 virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { | 55 void onDraw(const int loops, SkCanvas*) SK_OVERRIDE { |
56 Proc proc = fProc; | 56 Proc proc = fProc; |
57 | 57 |
58 for (int i = 0; i < loops; ++i) { | 58 for (int i = 0; i < loops; ++i) { |
59 proc(fA, fB); | 59 proc(fA, fB); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 typedef Benchmark INHERITED; | 64 typedef Benchmark INHERITED; |
65 }; | 65 }; |
66 | 66 |
67 DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); ) | 67 DEF_BENCH( return SkNEW_ARGS(RegionContainBench, (sect_proc, "sect")); ) |
OLD | NEW |