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

Side by Side Diff: bench/RTreeBench.cpp

Issue 27933002: More clang warning fixes. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: trybot fixes Created 7 years, 2 months 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 | « no previous file | bench/benchmain.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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 private: 141 private:
142 SkBBoxHierarchy* fTree; 142 SkBBoxHierarchy* fTree;
143 MakeRectProc fProc; 143 MakeRectProc fProc;
144 SkString fName; 144 SkString fName;
145 bool fBulkLoad; 145 bool fBulkLoad;
146 QueryType fQuery; 146 QueryType fQuery;
147 typedef SkBenchmark INHERITED; 147 typedef SkBenchmark INHERITED;
148 }; 148 };
149 149
150 static inline SkIRect make_simple_rect(SkRandom&, int index, int numRects) {
151 SkIRect out = {0, 0, GENERATE_EXTENTS, GENERATE_EXTENTS};
152 return out;
153 }
154
155 static inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) { 150 static inline SkIRect make_concentric_rects_increasing(SkRandom&, int index, int numRects) {
156 SkIRect out = {0, 0, index + 1, index + 1}; 151 SkIRect out = {0, 0, index + 1, index + 1};
157 return out; 152 return out;
158 } 153 }
159 154
160 static inline SkIRect make_concentric_rects_decreasing(SkRandom&, int index, int numRects) {
161 SkIRect out = {0, 0, numRects - index, numRects - index};
162 return out;
163 }
164
165 static inline SkIRect make_XYordered_rects(SkRandom& rand, int index, int numRec ts) { 155 static inline SkIRect make_XYordered_rects(SkRandom& rand, int index, int numRec ts) {
166 SkIRect out; 156 SkIRect out;
167 out.fLeft = index % GRID_WIDTH; 157 out.fLeft = index % GRID_WIDTH;
168 out.fTop = index / GRID_WIDTH; 158 out.fTop = index / GRID_WIDTH;
169 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 159 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 3);
170 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 160 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3);
171 return out; 161 return out;
172 } 162 }
173 static inline SkIRect make_YXordered_rects(SkRandom& rand, int index, int numRec ts) { 163 static inline SkIRect make_YXordered_rects(SkRandom& rand, int index, int numRec ts) {
174 SkIRect out; 164 SkIRect out;
175 out.fLeft = index / GRID_WIDTH; 165 out.fLeft = index / GRID_WIDTH;
176 out.fTop = index % GRID_WIDTH; 166 out.fTop = index % GRID_WIDTH;
177 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 167 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 3);
178 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3); 168 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 3);
179 return out; 169 return out;
180 } 170 }
181 171
182 static inline SkIRect make_point_rects(SkRandom& rand, int index, int numRects) {
183 SkIRect out;
184 out.fLeft = rand.nextU() % GENERATE_EXTENTS;
185 out.fTop = rand.nextU() % GENERATE_EXTENTS;
186 out.fRight = out.fLeft + (GENERATE_EXTENTS / 200);
187 out.fBottom = out.fTop + (GENERATE_EXTENTS / 200);
188 return out;
189 }
190
191 static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects) { 172 static inline SkIRect make_random_rects(SkRandom& rand, int index, int numRects) {
192 SkIRect out; 173 SkIRect out;
193 out.fLeft = rand.nextS() % GENERATE_EXTENTS; 174 out.fLeft = rand.nextS() % GENERATE_EXTENTS;
194 out.fTop = rand.nextS() % GENERATE_EXTENTS; 175 out.fTop = rand.nextS() % GENERATE_EXTENTS;
195 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); 176 out.fRight = out.fLeft + 1 + rand.nextU() % (GENERATE_EXTENTS / 5);
196 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 5); 177 out.fBottom = out.fTop + 1 + rand.nextU() % (GENERATE_EXTENTS / 5);
197 return out; 178 return out;
198 } 179 }
199 180
200 static inline SkIRect make_large_rects(SkRandom& rand, int index, int numRects) {
201 SkIRect out;
202 out.fLeft = rand.nextU() % GENERATE_EXTENTS;
203 out.fTop = rand.nextU() % GENERATE_EXTENTS;
204 out.fRight = out.fLeft + (GENERATE_EXTENTS / 3);
205 out.fBottom = out.fTop + (GENERATE_EXTENTS / 3);
206 return out;
207 }
208
209 /////////////////////////////////////////////////////////////////////////////// 181 ///////////////////////////////////////////////////////////////////////////////
210 182
211 DEF_BENCH( 183 DEF_BENCH(
212 return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, false , 184 return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, false ,
213 SkRTree::Create(5, 16))); 185 SkRTree::Create(5, 16)));
214 ) 186 )
215 DEF_BENCH( 187 DEF_BENCH(
216 return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, true, 188 return SkNEW_ARGS(BBoxBuildBench, ("XYordered", &make_XYordered_rects, true,
217 SkRTree::Create(5, 16))); 189 SkRTree::Create(5, 16)));
218 ) 190 )
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 &make_concentric_rects_increasing, true, SkRTree::Create(5 , 16, 1, false))); 252 &make_concentric_rects_increasing, true, SkRTree::Create(5 , 16, 1, false)));
281 ) 253 )
282 DEF_BENCH( 254 DEF_BENCH(
283 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr easing, true, 255 return SkNEW_ARGS(BBoxQueryBench, ("concentric", &make_concentric_rects_incr easing, true,
284 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)) ); 256 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16)) );
285 ) 257 )
286 DEF_BENCH( 258 DEF_BENCH(
287 return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_ rects_increasing, true, 259 return SkNEW_ARGS(BBoxQueryBench, ("(unsorted)concentric", &make_concentric_ rects_increasing, true,
288 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false))); 260 BBoxQueryBench::kRandom_QueryType, SkRTree::Create(5, 16, 1, false)));
289 ) 261 )
OLDNEW
« no previous file with comments | « no previous file | bench/benchmain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698