OLD | NEW |
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 Loading... |
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 Loading... |
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); |
OLD | NEW |