OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 protected: | 36 protected: |
37 virtual SkString onShortName() { | 37 virtual SkString onShortName() { |
38 return SkString("hittestpath"); | 38 return SkString("hittestpath"); |
39 } | 39 } |
40 | 40 |
41 virtual SkISize onISize() { return SkISize::Make(700, 460); } | 41 virtual SkISize onISize() { return SkISize::Make(700, 460); } |
42 | 42 |
43 virtual void onDraw(SkCanvas* canvas) { | 43 virtual void onDraw(SkCanvas* canvas) { |
44 SkPath path; | 44 SkPath path; |
45 SkRandom rand; | 45 SkLCGRandom rand; |
46 | 46 |
47 int scale = 300; | 47 int scale = 300; |
48 for (int i = 0; i < 4; ++i) { | 48 for (int i = 0; i < 4; ++i) { |
49 path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale
); | 49 path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale
); |
50 path.quadTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale
, | 50 path.quadTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale
, |
51 rand.nextUScalar1() * scale, rand.nextUScalar1() * scale
); | 51 rand.nextUScalar1() * scale, rand.nextUScalar1() * scale
); |
52 path.cubicTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scal
e, | 52 path.cubicTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scal
e, |
53 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal
e, | 53 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal
e, |
54 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal
e); | 54 rand.nextUScalar1() * scale, rand.nextUScalar1() * scal
e); |
55 } | 55 } |
(...skipping 10 matching lines...) Expand all Loading... |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
69 typedef GM INHERITED; | 69 typedef GM INHERITED; |
70 }; | 70 }; |
71 | 71 |
72 ////////////////////////////////////////////////////////////////////////////// | 72 ////////////////////////////////////////////////////////////////////////////// |
73 | 73 |
74 static skiagm::GM* MyFactory(void*) { return new HitTestPathGM; } | 74 static skiagm::GM* MyFactory(void*) { return new HitTestPathGM; } |
75 static skiagm::GMRegistry reg(MyFactory); | 75 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |