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 13 matching lines...) Expand all Loading... |
24 return true; | 24 return true; |
25 } | 25 } |
26 return this->INHERITED::onQuery(evt); | 26 return this->INHERITED::onQuery(evt); |
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(-1); | 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 SkRandom rand; | 37 SkRandom rand; |
38 SkPath curves; | 38 SkPath curves; |
39 SkPath hulls; | 39 SkPath hulls; |
40 SkPath ctrlPts; | 40 SkPath ctrlPts; |
41 for (int i = 0; i < 100; ++i) { | 41 for (int i = 0; i < 100; ++i) { |
42 SkScalar pts[] = { | 42 SkScalar pts[] = { |
43 rand.nextUScalar1(), rand.nextUScalar1(), | 43 rand.nextUScalar1(), rand.nextUScalar1(), |
44 rand.nextUScalar1(), rand.nextUScalar1(), | 44 rand.nextUScalar1(), rand.nextUScalar1(), |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 typedef SampleView INHERITED; | 105 typedef SampleView INHERITED; |
106 }; | 106 }; |
107 | 107 |
108 ////////////////////////////////////////////////////////////////////////////// | 108 ////////////////////////////////////////////////////////////////////////////// |
109 | 109 |
110 static SkView* MyFactory() { return new HairCurvesView; } | 110 static SkView* MyFactory() { return new HairCurvesView; } |
111 static SkViewRegister reg(MyFactory); | 111 static SkViewRegister reg(MyFactory); |
OLD | NEW |