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

Side by Side Diff: samplecode/SampleVertices.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 | « samplecode/SampleTextAlpha.cpp ('k') | src/core/SkFloat.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 2011 Google Inc. 3 * Copyright 2011 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 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 int fCount; 137 int fCount;
138 SkPoint* fVerts; 138 SkPoint* fVerts;
139 SkPoint* fTexs; 139 SkPoint* fTexs;
140 140
141 Rec() : fCount(0), fVerts(NULL), fTexs(NULL) {} 141 Rec() : fCount(0), fVerts(NULL), fTexs(NULL) {}
142 ~Rec() { delete[] fVerts; delete[] fTexs; } 142 ~Rec() { delete[] fVerts; delete[] fTexs; }
143 }; 143 };
144 144
145 void make_tris(Rec* rec) { 145 void make_tris(Rec* rec) {
146 int n = 10; 146 int n = 10;
147 SkMWCRandom rand; 147 SkRandom rand;
148 148
149 rec->fMode = SkCanvas::kTriangles_VertexMode; 149 rec->fMode = SkCanvas::kTriangles_VertexMode;
150 rec->fCount = n * 3; 150 rec->fCount = n * 3;
151 rec->fVerts = new SkPoint[rec->fCount]; 151 rec->fVerts = new SkPoint[rec->fCount];
152 152
153 for (int i = 0; i < n; i++) { 153 for (int i = 0; i < n; i++) {
154 SkPoint* v = &rec->fVerts[i*3]; 154 SkPoint* v = &rec->fVerts[i*3];
155 for (int j = 0; j < 3; j++) { 155 for (int j = 0; j < 3; j++) {
156 v[j].set(rand.nextUScalar1() * 250, rand.nextUScalar1() * 250); 156 v[j].set(rand.nextUScalar1() * 250, rand.nextUScalar1() * 250);
157 } 157 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 Rec fRecs[3]; 225 Rec fRecs[3];
226 226
227 typedef SampleView INHERITED; 227 typedef SampleView INHERITED;
228 }; 228 };
229 229
230 ////////////////////////////////////////////////////////////////////////////// 230 //////////////////////////////////////////////////////////////////////////////
231 231
232 static SkView* MyFactory() { return new VerticesView; } 232 static SkView* MyFactory() { return new VerticesView; }
233 static SkViewRegister reg(MyFactory); 233 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleTextAlpha.cpp ('k') | src/core/SkFloat.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698