OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkQuadTree.h" | 10 #include "SkQuadTree.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 out.fTop = rand.nextS() % GENERATE_EXTENTS; | 173 out.fTop = rand.nextS() % GENERATE_EXTENTS; |
174 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); | 174 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); |
175 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); | 175 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); |
176 return out; | 176 return out; |
177 } | 177 } |
178 | 178 |
179 /////////////////////////////////////////////////////////////////////////////// | 179 /////////////////////////////////////////////////////////////////////////////// |
180 | 180 |
181 DEF_BENCH( | 181 DEF_BENCH( |
182 return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, | 182 return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, |
183 SkQuadTree::Create(QUAD_TREE_BOUNDS))); | 183 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
184 ) | 184 ) |
185 DEF_BENCH( | 185 DEF_BENCH( |
186 return SkNEW_ARGS(BBoxQueryBench, ("XYordered", &make_XYordered_rects, | 186 return SkNEW_ARGS(BBoxQueryBench, ("XYordered", &make_XYordered_rects, |
187 BBoxQueryBench::kRandom_QueryType, SkQuadTree::Create(QUAD
_TREE_BOUNDS))); | 187 BBoxQueryBench::kRandom_QueryType, |
| 188 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
188 ) | 189 ) |
189 DEF_BENCH( | 190 DEF_BENCH( |
190 return SkNEW_ARGS(BBoxBuildBench, ("YXordered", &make_YXordered_rects, | 191 return SkNEW_ARGS(BBoxBuildBench, ("YXordered", &make_YXordered_rects, |
191 SkQuadTree::Create(QUAD_TREE_BOUNDS))); | 192 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
192 ) | 193 ) |
193 DEF_BENCH( | 194 DEF_BENCH( |
194 return SkNEW_ARGS(BBoxQueryBench, ("YXordered", &make_YXordered_rects, | 195 return SkNEW_ARGS(BBoxQueryBench, ("YXordered", &make_YXordered_rects, |
195 BBoxQueryBench::kRandom_QueryType, SkQuadTree::Create(QUAD
_TREE_BOUNDS))); | 196 BBoxQueryBench::kRandom_QueryType, |
| 197 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
196 ) | 198 ) |
197 DEF_BENCH( | 199 DEF_BENCH( |
198 return SkNEW_ARGS(BBoxBuildBench, ("random", &make_random_rects, | 200 return SkNEW_ARGS(BBoxBuildBench, ("random", &make_random_rects, |
199 SkQuadTree::Create(QUAD_TREE_BOUNDS))); | 201 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
200 ) | 202 ) |
201 DEF_BENCH( | 203 DEF_BENCH( |
202 return SkNEW_ARGS(BBoxQueryBench, ("random", &make_random_rects, | 204 return SkNEW_ARGS(BBoxQueryBench, ("random", &make_random_rects, |
203 BBoxQueryBench::kRandom_QueryType, SkQuadTree::Create(QUAD
_TREE_BOUNDS))); | 205 BBoxQueryBench::kRandom_QueryType, |
| 206 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
204 ) | 207 ) |
205 DEF_BENCH( | 208 DEF_BENCH( |
206 return SkNEW_ARGS(BBoxBuildBench, ("concentric", &make_concentric_rects_incr
easing, | 209 return SkNEW_ARGS(BBoxBuildBench, ("concentric", &make_concentric_rects_incr
easing, |
207 SkQuadTree::Create(QUAD_TREE_BOUNDS))); | 210 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
208 ) | 211 ) |
209 DEF_BENCH( | 212 DEF_BENCH( |
210 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr
easing, | 213 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr
easing, |
211 BBoxQueryBench::kRandom_QueryType, SkQuadTree::Create(QUAD
_TREE_BOUNDS))); | 214 BBoxQueryBench::kRandom_QueryType, |
| 215 SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); |
212 ) | 216 ) |
OLD | NEW |