Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: bench/RTreeBench.cpp

Issue 99893003: Simplify benchmark internal API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bench/PremulAndUnpremulAlphaOpsBench.cpp ('k') | bench/ReadPixBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBenchmark.h" 9 #include "SkBenchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 29 matching lines...) Expand all
40 return backend == kNonRendering_Backend; 40 return backend == kNonRendering_Backend;
41 } 41 }
42 42
43 virtual ~BBoxBuildBench() { 43 virtual ~BBoxBuildBench() {
44 fTree->unref(); 44 fTree->unref();
45 } 45 }
46 protected: 46 protected:
47 virtual const char* onGetName() SK_OVERRIDE { 47 virtual const char* onGetName() SK_OVERRIDE {
48 return fName.c_str(); 48 return fName.c_str();
49 } 49 }
50 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 50 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
51 SkRandom rand; 51 SkRandom rand;
52 for (int i = 0; i < this->getLoops(); ++i) { 52 for (int i = 0; i < loops; ++i) {
53 for (int j = 0; j < NUM_BUILD_RECTS; ++j) { 53 for (int j = 0; j < NUM_BUILD_RECTS; ++j) {
54 fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, NUM_BUI LD_RECTS), 54 fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j, NUM_BUI LD_RECTS),
55 fBulkLoad); 55 fBulkLoad);
56 } 56 }
57 fTree->flushDeferredInserts(); 57 fTree->flushDeferredInserts();
58 fTree->clear(); 58 fTree->clear();
59 } 59 }
60 } 60 }
61 private: 61 private:
62 SkBBoxHierarchy* fTree; 62 SkBBoxHierarchy* fTree;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 virtual void onPreDraw() SK_OVERRIDE { 104 virtual void onPreDraw() SK_OVERRIDE {
105 SkRandom rand; 105 SkRandom rand;
106 for (int j = 0; j < NUM_QUERY_RECTS; ++j) { 106 for (int j = 0; j < NUM_QUERY_RECTS; ++j) {
107 fTree->insert(reinterpret_cast<void*>(j), 107 fTree->insert(reinterpret_cast<void*>(j),
108 fProc(rand, j, NUM_QUERY_RECTS), 108 fProc(rand, j, NUM_QUERY_RECTS),
109 fBulkLoad); 109 fBulkLoad);
110 } 110 }
111 fTree->flushDeferredInserts(); 111 fTree->flushDeferredInserts();
112 } 112 }
113 113
114 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 114 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
115 SkRandom rand; 115 SkRandom rand;
116 for (int i = 0; i < this->getLoops(); ++i) { 116 for (int i = 0; i < loops; ++i) {
117 SkTDArray<void*> hits; 117 SkTDArray<void*> hits;
118 SkIRect query; 118 SkIRect query;
119 switch(fQuery) { 119 switch(fQuery) {
120 case kSmall_QueryType: 120 case kSmall_QueryType:
121 query.fLeft = rand.nextU() % GENERATE_EXTENTS; 121 query.fLeft = rand.nextU() % GENERATE_EXTENTS;
122 query.fTop = rand.nextU() % GENERATE_EXTENTS; 122 query.fTop = rand.nextU() % GENERATE_EXTENTS;
123 query.fRight = query.fLeft + (GENERATE_EXTENTS / 20); 123 query.fRight = query.fLeft + (GENERATE_EXTENTS / 20);
124 query.fBottom = query.fTop + (GENERATE_EXTENTS / 20); 124 query.fBottom = query.fTop + (GENERATE_EXTENTS / 20);
125 break; 125 break;
126 case kLarge_QueryType: 126 case kLarge_QueryType:
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 &make_concentric_rects_increasing, true, SkRTree::Create(5 , 16, 1, false))); 260 &make_concentric_rects_increasing, true, SkRTree::Create(5 , 16, 1, false)));
261 ) 261 )
262 DEF_BENCH( 262 DEF_BENCH(
263 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr easing, true, 263 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr easing, true,
264 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)) ); 264 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)) );
265 ) 265 )
266 DEF_BENCH( 266 DEF_BENCH(
267 return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_ rects_increasing, true, 267 return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_ rects_increasing, true,
268 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false))); 268 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
269 ) 269 )
OLDNEW
« no previous file with comments | « bench/PremulAndUnpremulAlphaOpsBench.cpp ('k') | bench/ReadPixBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698