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

Side by Side Diff: bench/VertBench.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/TextBench.cpp ('k') | bench/XfermodeBench.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 2011 Google Inc. 2 * Copyright 2011 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 "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 SkASSERT(idx[i] < PTS); 61 SkASSERT(idx[i] < PTS);
62 } 62 }
63 idx += 6; 63 idx += 6;
64 } 64 }
65 } 65 }
66 yy += dy; 66 yy += dy;
67 } 67 }
68 SkASSERT(PTS == pts - fPts); 68 SkASSERT(PTS == pts - fPts);
69 SkASSERT(IDX == idx - fIdx); 69 SkASSERT(IDX == idx - fIdx);
70 70
71 SkMWCRandom rand; 71 SkRandom rand;
72 for (int i = 0; i < PTS; ++i) { 72 for (int i = 0; i < PTS; ++i) {
73 fColors[i] = rand.nextU() | (0xFF << 24); 73 fColors[i] = rand.nextU() | (0xFF << 24);
74 } 74 }
75 75
76 fName.set("verts"); 76 fName.set("verts");
77 } 77 }
78 78
79 protected: 79 protected:
80 virtual const char* onGetName() { return fName.c_str(); } 80 virtual const char* onGetName() { return fName.c_str(); }
81 virtual void onDraw(SkCanvas* canvas) { 81 virtual void onDraw(SkCanvas* canvas) {
82 SkPaint paint; 82 SkPaint paint;
83 this->setupPaint(&paint); 83 this->setupPaint(&paint);
84 84
85 for (int i = 0; i < N; i++) { 85 for (int i = 0; i < N; i++) {
86 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS, 86 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS,
87 fPts, NULL, fColors, NULL, fIdx, IDX, paint); 87 fPts, NULL, fColors, NULL, fIdx, IDX, paint);
88 } 88 }
89 } 89 }
90 private: 90 private:
91 typedef SkBenchmark INHERITED; 91 typedef SkBenchmark INHERITED;
92 }; 92 };
93 93
94 /////////////////////////////////////////////////////////////////////////////// 94 ///////////////////////////////////////////////////////////////////////////////
95 95
96 static SkBenchmark* Fact(void* p) { return SkNEW_ARGS(VertBench, (p)); } 96 static SkBenchmark* Fact(void* p) { return SkNEW_ARGS(VertBench, (p)); }
97 97
98 static BenchRegistry gReg(Fact); 98 static BenchRegistry gReg(Fact);
OLDNEW
« no previous file with comments | « bench/TextBench.cpp ('k') | bench/XfermodeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698