1c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org/* 2c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org * Copyright 2014 Google Inc. 3c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org * 4c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org * Use of this source code is governed by a BSD-style license that can be 5c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org * found in the LICENSE file. 6c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org */ 7c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 8f168b86d7fafc5c20c87bebc6fd393cb17e120catfarina#include "Benchmark.h" 9c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org#include "SkCanvas.h" 10c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org#include "SkQuadTree.h" 11c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org#include "SkRandom.h" 12c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org#include "SkString.h" 13c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 14c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org// confine rectangles to a smallish area, so queries generally hit something, and overlap occurs: 15c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic const int GENERATE_EXTENTS = 1000; 16c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic const int NUM_BUILD_RECTS = 500; 17c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic const int NUM_QUERY_RECTS = 5000; 18c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic const int GRID_WIDTH = 100; 19c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic const SkIRect QUAD_TREE_BOUNDS = SkIRect::MakeLTRB( 20c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org -GENERATE_EXTENTS, -GENERATE_EXTENTS, 2 * GENERATE_EXTENTS, 2 * GENERATE_EXTENTS); 21c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 22c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgtypedef SkIRect (*MakeRectProc)(SkRandom&, int, int); 23c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 24c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org// Time how long it takes to build an QuadTree 25f168b86d7fafc5c20c87bebc6fd393cb17e120catfarinaclass QuadTreeBuildBench : public Benchmark { 26c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgpublic: 27b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org QuadTreeBuildBench(const char* name, MakeRectProc proc, SkBBoxHierarchy* tree) 28c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org : fTree(tree) 29c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org , fProc(proc) { 30c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fName.append("quadtree_"); 31c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fName.append(name); 32c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fName.append("_build"); 33c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 34c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 35c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 36c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return backend == kNonRendering_Backend; 37c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 38c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 39b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org virtual ~QuadTreeBuildBench() { 40c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fTree->unref(); 41c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 42c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgprotected: 43c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org virtual const char* onGetName() SK_OVERRIDE { 44c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return fName.c_str(); 45c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 46c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 47c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkRandom rand; 48c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org for (int i = 0; i < loops; ++i) { 49c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org for (int j = 0; j < NUM_BUILD_RECTS; ++j) { 50c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, NUM_BUILD_RECTS), 51c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org false); 52c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 53c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fTree->clear(); 54c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 55c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 56c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgprivate: 57c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkBBoxHierarchy* fTree; 58c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org MakeRectProc fProc; 59c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkString fName; 60f168b86d7fafc5c20c87bebc6fd393cb17e120catfarina typedef Benchmark INHERITED; 61c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org}; 62c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 63c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org// Time how long it takes to perform queries on an QuadTree 64f168b86d7fafc5c20c87bebc6fd393cb17e120catfarinaclass QuadTreeQueryBench : public Benchmark { 65c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgpublic: 66c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org enum QueryType { 67c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org kSmall_QueryType, // small queries 68c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org kLarge_QueryType, // large queries 69c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org kRandom_QueryType,// randomly sized queries 70c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org kFull_QueryType // queries that cover everything 71c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org }; 72c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 73b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org QuadTreeQueryBench(const char* name, MakeRectProc proc, 74c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org QueryType q, SkBBoxHierarchy* tree) 75c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org : fTree(tree) 76c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org , fProc(proc) 77c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org , fQuery(q) { 78c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fName.append("quadtree_"); 79c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fName.append(name); 80c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fName.append("_query"); 81c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 82c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 83c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { 84c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return backend == kNonRendering_Backend; 85c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 86c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 87b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org virtual ~QuadTreeQueryBench() { 88c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fTree->unref(); 89c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 90c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgprotected: 91c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org virtual const char* onGetName() SK_OVERRIDE { 92c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return fName.c_str(); 93c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 94c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org virtual void onPreDraw() SK_OVERRIDE { 95c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkRandom rand; 96c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org for (int j = 0; j < NUM_QUERY_RECTS; ++j) { 97c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fTree->insert(reinterpret_cast<void*>(j), 98c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fProc(rand, j, NUM_QUERY_RECTS), 99c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org false); 100c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 101c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fTree->flushDeferredInserts(); 102c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 103c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 104c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 105c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkRandom rand; 106c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org for (int i = 0; i < loops; ++i) { 107c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkTDArray<void*> hits; 108c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkIRect query; 109c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org switch(fQuery) { 110c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org case kSmall_QueryType: 111c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fLeft = rand.nextU() % GENERATE_EXTENTS; 112c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fTop = rand.nextU() % GENERATE_EXTENTS; 113c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fRight = query.fLeft + (GENERATE_EXTENTS / 20); 114c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fBottom = query.fTop + (GENERATE_EXTENTS / 20); 115c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org break; 116c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org case kLarge_QueryType: 117c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fLeft = rand.nextU() % GENERATE_EXTENTS; 118c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fTop = rand.nextU() % GENERATE_EXTENTS; 119c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fRight = query.fLeft + (GENERATE_EXTENTS / 2); 120c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fBottom = query.fTop + (GENERATE_EXTENTS / 2); 121c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org break; 122c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org case kFull_QueryType: 123c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fLeft = -GENERATE_EXTENTS; 124c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fTop = -GENERATE_EXTENTS; 125c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fRight = 2 * GENERATE_EXTENTS; 126c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fBottom = 2 * GENERATE_EXTENTS; 127c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org break; 128c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org default: // fallthrough 129c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org case kRandom_QueryType: 130c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fLeft = rand.nextU() % GENERATE_EXTENTS; 131c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fTop = rand.nextU() % GENERATE_EXTENTS; 132c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fRight = query.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 2); 133c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org query.fBottom = query.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 2); 134c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org break; 135c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org }; 136c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org fTree->search(query, &hits); 137c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 138c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org } 139c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgprivate: 140c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkBBoxHierarchy* fTree; 141c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org MakeRectProc fProc; 142c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkString fName; 143c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org QueryType fQuery; 144f168b86d7fafc5c20c87bebc6fd393cb17e120catfarina typedef Benchmark INHERITED; 145c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org}; 146c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 147c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) { 148c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkIRect out = {0, 0, index + 1, index + 1}; 149c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return out; 150c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org} 151c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 152c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic inline SkIRect make_XYordered_rects(SkRandom& rand, int index, int numRects) { 153c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkIRect out; 154c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fLeft = index % GRID_WIDTH; 155c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fTop = index / GRID_WIDTH; 156c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 157c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 158c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return out; 159c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org} 160c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 161c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic inline SkIRect make_YXordered_rects(SkRandom& rand, int index, int numRects) { 162c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkIRect out; 163c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fLeft = index / GRID_WIDTH; 164c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fTop = index % GRID_WIDTH; 165c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 166c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 167c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return out; 168c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org} 169c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 170c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgstatic inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects) { 171c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org SkIRect out; 172c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fLeft = rand.nextS() % GENERATE_EXTENTS; 173c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fTop = rand.nextS() % GENERATE_EXTENTS; 174c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); 175c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); 176c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org return out; 177c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org} 178c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 179c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org/////////////////////////////////////////////////////////////////////////////// 180c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org 181c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 182b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeBuildBench, ("XYordered", &make_XYordered_rects, 183949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 184c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 185c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 186b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeQueryBench, ("XYordered", &make_XYordered_rects, 187b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org QuadTreeQueryBench::kRandom_QueryType, 188949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 189c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 190c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 191b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeBuildBench, ("YXordered", &make_YXordered_rects, 192949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 193c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 194c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 195b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeQueryBench, ("YXordered", &make_YXordered_rects, 196b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org QuadTreeQueryBench::kRandom_QueryType, 197949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 198c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 199c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 200b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeBuildBench, ("random", &make_random_rects, 201949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 202c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 203c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 204b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeQueryBench, ("random", &make_random_rects, 205b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org QuadTreeQueryBench::kRandom_QueryType, 206949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 207c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 208c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 209b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeBuildBench, ("concentric", &make_concentric_rects_increasing, 210949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 211c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 212c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.orgDEF_BENCH( 213b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org return SkNEW_ARGS(QuadTreeQueryBench, ("concentric", &make_concentric_rects_increasing, 214b2db44376eedaba05f6eae4251016009cd3c607dcommit-bot@chromium.org QuadTreeQueryBench::kRandom_QueryType, 215949b9986de23993f163a324a1234547dd2d09be7commit-bot@chromium.org SkNEW_ARGS(SkQuadTree, (QUAD_TREE_BOUNDS)))); 216c22d1398089fdb95480fb3459b23e4931e4f5280commit-bot@chromium.org) 217