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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 private: | 97 private: |
98 SkScalar fRadius; | 98 SkScalar fRadius; |
99 SkTDArray<SkPoint>* fPts; | 99 SkTDArray<SkPoint>* fPts; |
100 | 100 |
101 typedef Sk2DPathEffect INHERITED; | 101 typedef Sk2DPathEffect INHERITED; |
102 }; | 102 }; |
103 | 103 |
104 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) { | 104 SkFlattenable* Dot2DPathEffect::CreateProc(SkReadBuffer& buffer) { |
105 SkMatrix matrix; | 105 SkMatrix matrix; |
106 buffer.readMatrix(&matrix); | 106 buffer.readMatrix(&matrix); |
107 return SkNEW_ARGS(Dot2DPathEffect, (buffer.readScalar(), matrix, NULL)); | 107 return new Dot2DPathEffect(buffer.readScalar(), matrix, NULL); |
108 } | 108 } |
109 | 109 |
110 class InverseFillPE : public SkPathEffect { | 110 class InverseFillPE : public SkPathEffect { |
111 public: | 111 public: |
112 InverseFillPE() {} | 112 InverseFillPE() {} |
113 virtual bool filterPath(SkPath* dst, const SkPath& src, | 113 virtual bool filterPath(SkPath* dst, const SkPath& src, |
114 SkStrokeRec*, const SkRect*) const override { | 114 SkStrokeRec*, const SkRect*) const override { |
115 *dst = src; | 115 *dst = src; |
116 dst->setFillType(SkPath::kInverseWinding_FillType); | 116 dst->setFillType(SkPath::kInverseWinding_FillType); |
117 return true; | 117 return true; |
118 } | 118 } |
119 | 119 |
120 #ifndef SK_IGNORE_TO_STRING | 120 #ifndef SK_IGNORE_TO_STRING |
121 void toString(SkString* str) const override { | 121 void toString(SkString* str) const override { |
122 str->appendf("InverseFillPE: ()"); | 122 str->appendf("InverseFillPE: ()"); |
123 } | 123 } |
124 #endif | 124 #endif |
125 | 125 |
126 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE) | 126 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE) |
127 | 127 |
128 private: | 128 private: |
129 typedef SkPathEffect INHERITED; | 129 typedef SkPathEffect INHERITED; |
130 }; | 130 }; |
131 | 131 |
132 SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) { | 132 SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) { return new Inve
rseFillPE; } |
133 return SkNEW(InverseFillPE); | |
134 } | |
135 | 133 |
136 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) { | 134 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) { |
137 SkMatrix lattice; | 135 SkMatrix lattice; |
138 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp); | 136 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp); |
139 lattice.setScale(rad*2, rad*2, 0, 0); | 137 lattice.setScale(rad*2, rad*2, 0, 0); |
140 lattice.postSkew(SK_Scalar1/3, 0, 0, 0); | 138 lattice.postSkew(SK_Scalar1/3, 0, 0, 0); |
141 return new Dot2DPathEffect(rad, lattice, pts); | 139 return new Dot2DPathEffect(rad, lattice, pts); |
142 } | 140 } |
143 | 141 |
144 static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p, SkScalar int
erp) { | 142 static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p, SkScalar int
erp) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 250 } |
253 | 251 |
254 private: | 252 private: |
255 typedef SkView INHERITED; | 253 typedef SkView INHERITED; |
256 }; | 254 }; |
257 | 255 |
258 ////////////////////////////////////////////////////////////////////////////// | 256 ////////////////////////////////////////////////////////////////////////////// |
259 | 257 |
260 static SkView* MyFactory() { return new ClockFaceView; } | 258 static SkView* MyFactory() { return new ClockFaceView; } |
261 static SkViewRegister reg(MyFactory); | 259 static SkViewRegister reg(MyFactory); |
OLD | NEW |