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

Side by Side Diff: bench/RegionContainBench.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 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 | « bench/RegionBench.cpp ('k') | bench/ScalarBench.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 * 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 "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkRegion.h" 10 #include "SkRegion.h"
(...skipping 11 matching lines...) Expand all
22 Proc fProc; 22 Proc fProc;
23 SkString fName; 23 SkString fName;
24 24
25 enum { 25 enum {
26 W = 200, 26 W = 200,
27 H = 200, 27 H = 200,
28 COUNT = 10, 28 COUNT = 10,
29 N = SkBENCHLOOP(20000) 29 N = SkBENCHLOOP(20000)
30 }; 30 };
31 31
32 SkIRect randrect(SkMWCRandom& rand, int i) { 32 SkIRect randrect(SkRandom& rand, int i) {
33 int w = rand.nextU() % W; 33 int w = rand.nextU() % W;
34 return SkIRect::MakeXYWH(0, i*H/COUNT, w, H/COUNT); 34 return SkIRect::MakeXYWH(0, i*H/COUNT, w, H/COUNT);
35 } 35 }
36 36
37 RegionContainBench(void* param, Proc proc, const char name[]) : INHERITED(pa ram) { 37 RegionContainBench(void* param, Proc proc, const char name[]) : INHERITED(pa ram) {
38 fProc = proc; 38 fProc = proc;
39 fName.printf("region_contains_%s", name); 39 fName.printf("region_contains_%s", name);
40 40
41 SkMWCRandom rand; 41 SkRandom rand;
42 for (int i = 0; i < COUNT; i++) { 42 for (int i = 0; i < COUNT; i++) {
43 fA.op(randrect(rand, i), SkRegion::kXOR_Op); 43 fA.op(randrect(rand, i), SkRegion::kXOR_Op);
44 } 44 }
45 45
46 fB.setRect(0, 0, H, W); 46 fB.setRect(0, 0, H, W);
47 47
48 fIsRendering = false; 48 fIsRendering = false;
49 } 49 }
50 50
51 protected: 51 protected:
52 virtual const char* onGetName() { return fName.c_str(); } 52 virtual const char* onGetName() { return fName.c_str(); }
53 53
54 virtual void onDraw(SkCanvas*) { 54 virtual void onDraw(SkCanvas*) {
55 Proc proc = fProc; 55 Proc proc = fProc;
56 56
57 for (int i = 0; i < N; ++i) { 57 for (int i = 0; i < N; ++i) {
58 proc(fA, fB); 58 proc(fA, fB);
59 } 59 }
60 } 60 }
61 61
62 private: 62 private:
63 typedef SkBenchmark INHERITED; 63 typedef SkBenchmark INHERITED;
64 }; 64 };
65 65
66 static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionContainBench, (p, sec t_proc, "sect")); } 66 static SkBenchmark* gF0(void* p) { return SkNEW_ARGS(RegionContainBench, (p, sec t_proc, "sect")); }
67 67
68 static BenchRegistry gR0(gF0); 68 static BenchRegistry gR0(gF0);
OLDNEW
« no previous file with comments | « bench/RegionBench.cpp ('k') | bench/ScalarBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698