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

Side by Side Diff: gm/hittestpath.cpp

Issue 805963002: There can be only one (SkRandom)! (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years 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
« no previous file with comments | « gm/getpostextpath.cpp ('k') | gm/linepaths.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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCullPoints.h" 10 #include "SkCullPoints.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 virtual SkString onShortName() { 41 virtual SkString onShortName() {
42 return SkString("hittestpath"); 42 return SkString("hittestpath");
43 } 43 }
44 44
45 virtual SkISize onISize() { return SkISize::Make(700, 460); } 45 virtual SkISize onISize() { return SkISize::Make(700, 460); }
46 46
47 virtual void onDraw(SkCanvas* canvas) { 47 virtual void onDraw(SkCanvas* canvas) {
48 SkPath path; 48 SkPath path;
49 SkLCGRandom rand; 49 SkRandom rand;
50 50
51 int scale = 300; 51 int scale = 300;
52 for (int i = 0; i < 4; ++i) { 52 for (int i = 0; i < 4; ++i) {
53 path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale ); 53 path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale );
54 path.quadTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale , 54 path.quadTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale ,
55 rand.nextUScalar1() * scale, rand.nextUScalar1() * scale ); 55 rand.nextUScalar1() * scale, rand.nextUScalar1() * scale );
56 path.cubicTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scal e, 56 path.cubicTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scal e,
57 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal e, 57 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal e,
58 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal e); 58 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal e);
59 } 59 }
(...skipping 10 matching lines...) Expand all
70 } 70 }
71 71
72 private: 72 private:
73 typedef GM INHERITED; 73 typedef GM INHERITED;
74 }; 74 };
75 75
76 ////////////////////////////////////////////////////////////////////////////// 76 //////////////////////////////////////////////////////////////////////////////
77 77
78 static skiagm::GM* MyFactory(void*) { return new HitTestPathGM; } 78 static skiagm::GM* MyFactory(void*) { return new HitTestPathGM; }
79 static skiagm::GMRegistry reg(MyFactory); 79 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/getpostextpath.cpp ('k') | gm/linepaths.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698