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

Side by Side Diff: gm/beziereffects.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 | « gm/arcofzorro.cpp ('k') | gm/circles.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 2013 Google Inc. 3 * Copyright 2013 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 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (NULL == context) { 67 if (NULL == context) {
68 return; 68 return;
69 } 69 }
70 70
71 struct Vertex { 71 struct Vertex {
72 SkPoint fPosition; 72 SkPoint fPosition;
73 float fKLM[4]; // The last value is ignored. The effect expects a vec4f. 73 float fKLM[4]; // The last value is ignored. The effect expects a vec4f.
74 }; 74 };
75 75
76 static const int kNumCubics = 15; 76 static const int kNumCubics = 15;
77 SkMWCRandom rand; 77 SkRandom rand;
78 78
79 // Mult by 3 for each edge effect type 79 // Mult by 3 for each edge effect type
80 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3) )); 80 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3) ));
81 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumCubics*3) / numCols); 81 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumCubics*3) / numCols);
82 SkScalar w = SkIntToScalar(rt->width()) / numCols; 82 SkScalar w = SkIntToScalar(rt->width()) / numCols;
83 SkScalar h = SkIntToScalar(rt->height()) / numRows; 83 SkScalar h = SkIntToScalar(rt->height()) / numRows;
84 int row = 0; 84 int row = 0;
85 int col = 0; 85 int col = 0;
86 86
87 for (int i = 0; i < kNumCubics; ++i) { 87 for (int i = 0; i < kNumCubics; ++i) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (NULL == context) { 219 if (NULL == context) {
220 return; 220 return;
221 } 221 }
222 222
223 struct Vertex { 223 struct Vertex {
224 SkPoint fPosition; 224 SkPoint fPosition;
225 float fKLM[4]; // The last value is ignored. The effect expects a vec4f. 225 float fKLM[4]; // The last value is ignored. The effect expects a vec4f.
226 }; 226 };
227 227
228 static const int kNumConics = 10; 228 static const int kNumConics = 10;
229 SkMWCRandom rand; 229 SkRandom rand;
230 230
231 // Mult by 3 for each edge effect type 231 // Mult by 3 for each edge effect type
232 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3) )); 232 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3) ));
233 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumConics*3) / numCols); 233 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumConics*3) / numCols);
234 SkScalar w = SkIntToScalar(rt->width()) / numCols; 234 SkScalar w = SkIntToScalar(rt->width()) / numCols;
235 SkScalar h = SkIntToScalar(rt->height()) / numRows; 235 SkScalar h = SkIntToScalar(rt->height()) / numRows;
236 int row = 0; 236 int row = 0;
237 int col = 0; 237 int col = 0;
238 238
239 for (int i = 0; i < kNumConics; ++i) { 239 for (int i = 0; i < kNumConics; ++i) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (NULL == context) { 404 if (NULL == context) {
405 return; 405 return;
406 } 406 }
407 407
408 struct Vertex { 408 struct Vertex {
409 SkPoint fPosition; 409 SkPoint fPosition;
410 float fUV[4]; // The last two values are ignored. The effect expec ts a vec4f. 410 float fUV[4]; // The last two values are ignored. The effect expec ts a vec4f.
411 }; 411 };
412 412
413 static const int kNumQuads = 5; 413 static const int kNumQuads = 5;
414 SkMWCRandom rand; 414 SkRandom rand;
415 415
416 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3)) ); 416 int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3)) );
417 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols); 417 int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols);
418 SkScalar w = SkIntToScalar(rt->width()) / numCols; 418 SkScalar w = SkIntToScalar(rt->width()) / numCols;
419 SkScalar h = SkIntToScalar(rt->height()) / numRows; 419 SkScalar h = SkIntToScalar(rt->height()) / numRows;
420 int row = 0; 420 int row = 0;
421 int col = 0; 421 int col = 0;
422 422
423 for (int i = 0; i < kNumQuads; ++i) { 423 for (int i = 0; i < kNumQuads; ++i) {
424 SkPoint baseControlPts[] = { 424 SkPoint baseControlPts[] = {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 typedef GM INHERITED; 509 typedef GM INHERITED;
510 }; 510 };
511 511
512 DEF_GM( return SkNEW(BezierCubicEffects); ) 512 DEF_GM( return SkNEW(BezierCubicEffects); )
513 DEF_GM( return SkNEW(BezierConicEffects); ) 513 DEF_GM( return SkNEW(BezierConicEffects); )
514 DEF_GM( return SkNEW(BezierQuadEffects); ) 514 DEF_GM( return SkNEW(BezierQuadEffects); )
515 515
516 } 516 }
517 517
518 #endif 518 #endif
OLDNEW
« no previous file with comments | « gm/arcofzorro.cpp ('k') | gm/circles.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698