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 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 virtual void onDrawContent(SkCanvas* canvas) { | 30 virtual void onDrawContent(SkCanvas* canvas) { |
31 SkPaint paint; | 31 SkPaint paint; |
32 paint.setAntiAlias(true); | 32 paint.setAntiAlias(true); |
33 paint.setStyle(SkPaint::kStroke_Style); | 33 paint.setStyle(SkPaint::kStroke_Style); |
34 paint.setStrokeWidth(0); | 34 paint.setStrokeWidth(0); |
35 canvas->save(); | 35 canvas->save(); |
36 canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1); | 36 canvas->scale(1000 * SK_Scalar1, 1000 * SK_Scalar1); |
37 SkMWCRandom rand; | 37 SkRandom rand; |
38 SkMWCRandom randW; | 38 SkRandom randW; |
39 SkPath curves; | 39 SkPath curves; |
40 SkPath hulls; | 40 SkPath hulls; |
41 SkPath ctrlPts; | 41 SkPath ctrlPts; |
42 for (int i = 0; i < 100; ++i) { | 42 for (int i = 0; i < 100; ++i) { |
43 SkScalar pts[] = { | 43 SkScalar pts[] = { |
44 rand.nextUScalar1(), rand.nextUScalar1(), | 44 rand.nextUScalar1(), rand.nextUScalar1(), |
45 rand.nextUScalar1(), rand.nextUScalar1(), | 45 rand.nextUScalar1(), rand.nextUScalar1(), |
46 rand.nextUScalar1(), rand.nextUScalar1(), | 46 rand.nextUScalar1(), rand.nextUScalar1(), |
47 rand.nextUScalar1(), rand.nextUScalar1() | 47 rand.nextUScalar1(), rand.nextUScalar1() |
48 }; | 48 }; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 private: | 126 private: |
127 typedef SampleView INHERITED; | 127 typedef SampleView INHERITED; |
128 }; | 128 }; |
129 | 129 |
130 ////////////////////////////////////////////////////////////////////////////// | 130 ////////////////////////////////////////////////////////////////////////////// |
131 | 131 |
132 static SkView* MyFactory() { return new HairCurvesView; } | 132 static SkView* MyFactory() { return new HairCurvesView; } |
133 static SkViewRegister reg(MyFactory); | 133 static SkViewRegister reg(MyFactory); |
OLD | NEW |