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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 class Dot2DPathEffect : public Sk2DPathEffect { | 69 class Dot2DPathEffect : public Sk2DPathEffect { |
70 public: | 70 public: |
71 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix, | 71 Dot2DPathEffect(SkScalar radius, const SkMatrix& matrix, |
72 SkTDArray<SkPoint>* pts) | 72 SkTDArray<SkPoint>* pts) |
73 : Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {} | 73 : Sk2DPathEffect(matrix), fRadius(radius), fPts(pts) {} |
74 | 74 |
75 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect) | 75 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect) |
76 | 76 |
77 protected: | 77 protected: |
78 virtual void begin(const SkIRect& uvBounds, SkPath* dst) const SK_OVERRIDE { | 78 void begin(const SkIRect& uvBounds, SkPath* dst) const SK_OVERRIDE { |
79 if (fPts) { | 79 if (fPts) { |
80 fPts->reset(); | 80 fPts->reset(); |
81 } | 81 } |
82 this->INHERITED::begin(uvBounds, dst); | 82 this->INHERITED::begin(uvBounds, dst); |
83 } | 83 } |
84 | 84 |
85 virtual void next(const SkPoint& loc, int u, int v, | 85 virtual void next(const SkPoint& loc, int u, int v, |
86 SkPath* dst) const SK_OVERRIDE { | 86 SkPath* dst) const SK_OVERRIDE { |
87 if (fPts) { | 87 if (fPts) { |
88 *fPts->append() = loc; | 88 *fPts->append() = loc; |
89 } | 89 } |
90 dst->addCircle(loc.fX, loc.fY, fRadius); | 90 dst->addCircle(loc.fX, loc.fY, fRadius); |
91 } | 91 } |
92 | 92 |
93 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { | 93 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { |
94 buffer.writeMatrix(this->getMatrix()); | 94 buffer.writeMatrix(this->getMatrix()); |
95 buffer.writeScalar(fRadius); | 95 buffer.writeScalar(fRadius); |
96 } | 96 } |
97 | 97 |
98 private: | 98 private: |
99 SkScalar fRadius; | 99 SkScalar fRadius; |
100 SkTDArray<SkPoint>* fPts; | 100 SkTDArray<SkPoint>* fPts; |
101 | 101 |
102 typedef Sk2DPathEffect INHERITED; | 102 typedef Sk2DPathEffect INHERITED; |
103 }; | 103 }; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 246 } |
247 | 247 |
248 private: | 248 private: |
249 typedef SkView INHERITED; | 249 typedef SkView INHERITED; |
250 }; | 250 }; |
251 | 251 |
252 ////////////////////////////////////////////////////////////////////////////// | 252 ////////////////////////////////////////////////////////////////////////////// |
253 | 253 |
254 static SkView* MyFactory() { return new ClockFaceView; } | 254 static SkView* MyFactory() { return new ClockFaceView; } |
255 static SkViewRegister reg(MyFactory); | 255 static SkViewRegister reg(MyFactory); |
OLD | NEW |