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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SK_OVERRIDE { | 114 SkStrokeRec*, const SkRect*) const SK_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 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE) | 119 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE) |
120 | 120 |
121 protected: | 121 protected: |
| 122 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
122 InverseFillPE(SkReadBuffer& buffer) : INHERITED(buffer) {} | 123 InverseFillPE(SkReadBuffer& buffer) : INHERITED(buffer) {} |
| 124 #endif |
| 125 |
123 private: | 126 private: |
124 | 127 |
125 typedef SkPathEffect INHERITED; | 128 typedef SkPathEffect INHERITED; |
126 }; | 129 }; |
127 | 130 |
| 131 SkFlattenable* InverseFillPE::CreateProc(SkReadBuffer& buffer) { |
| 132 return SkNEW(InverseFillPE); |
| 133 } |
| 134 |
128 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) { | 135 static SkPathEffect* makepe(float interp, SkTDArray<SkPoint>* pts) { |
129 SkMatrix lattice; | 136 SkMatrix lattice; |
130 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp); | 137 SkScalar rad = 3 + SkIntToScalar(4) * (1 - interp); |
131 lattice.setScale(rad*2, rad*2, 0, 0); | 138 lattice.setScale(rad*2, rad*2, 0, 0); |
132 lattice.postSkew(SK_Scalar1/3, 0, 0, 0); | 139 lattice.postSkew(SK_Scalar1/3, 0, 0, 0); |
133 return new Dot2DPathEffect(rad, lattice, pts); | 140 return new Dot2DPathEffect(rad, lattice, pts); |
134 } | 141 } |
135 | 142 |
136 static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p, SkScalar int
erp) { | 143 static void r7(SkLayerRasterizer::Builder* rastBuilder, SkPaint& p, SkScalar int
erp) { |
137 p.setPathEffect(makepe(SkScalarToFloat(interp), NULL))->unref(); | 144 p.setPathEffect(makepe(SkScalarToFloat(interp), NULL))->unref(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 251 } |
245 | 252 |
246 private: | 253 private: |
247 typedef SkView INHERITED; | 254 typedef SkView INHERITED; |
248 }; | 255 }; |
249 | 256 |
250 ////////////////////////////////////////////////////////////////////////////// | 257 ////////////////////////////////////////////////////////////////////////////// |
251 | 258 |
252 static SkView* MyFactory() { return new ClockFaceView; } | 259 static SkView* MyFactory() { return new ClockFaceView; } |
253 static SkViewRegister reg(MyFactory); | 260 static SkViewRegister reg(MyFactory); |
OLD | NEW |