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

Side by Side Diff: samplecode/SamplePathEffects.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/SampleManyRects.cpp ('k') | samplecode/SamplePicture.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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 this->addLayer(paint); 95 this->addLayer(paint);
96 #endif 96 #endif
97 } 97 }
98 }; 98 };
99 99
100 class PathEffectView : public SampleView { 100 class PathEffectView : public SampleView {
101 SkPath fPath; 101 SkPath fPath;
102 SkPoint fClickPt; 102 SkPoint fClickPt;
103 public: 103 public:
104 PathEffectView() { 104 PathEffectView() {
105 SkMWCRandom rand; 105 SkRandom rand;
106 int steps = 20; 106 int steps = 20;
107 SkScalar dist = SkIntToScalar(400); 107 SkScalar dist = SkIntToScalar(400);
108 SkScalar x = SkIntToScalar(20); 108 SkScalar x = SkIntToScalar(20);
109 SkScalar y = SkIntToScalar(50); 109 SkScalar y = SkIntToScalar(50);
110 110
111 fPath.moveTo(x, y); 111 fPath.moveTo(x, y);
112 for (int i = 0; i < steps; i++) { 112 for (int i = 0; i < steps; i++) {
113 x += dist/steps; 113 x += dist/steps;
114 SkScalar tmpY = y + SkIntToScalar(rand.nextS() % 25); 114 SkScalar tmpY = y + SkIntToScalar(rand.nextS() % 25);
115 if (i == steps/2) { 115 if (i == steps/2) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 private: 183 private:
184 typedef SampleView INHERITED; 184 typedef SampleView INHERITED;
185 }; 185 };
186 186
187 ////////////////////////////////////////////////////////////////////////////// 187 //////////////////////////////////////////////////////////////////////////////
188 188
189 static SkView* MyFactory() { return new PathEffectView; } 189 static SkView* MyFactory() { return new PathEffectView; }
190 static SkViewRegister reg(MyFactory); 190 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleManyRects.cpp ('k') | samplecode/SamplePicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698