OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkDrawExtraPathEffect.h" | 8 #include "SkDrawExtraPathEffect.h" |
9 #include "SkDrawPath.h" | 9 #include "SkDrawPath.h" |
10 #include "Sk1DPathEffect.h" | 10 #include "Sk1DPathEffect.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 #include "SkDisplayApply.h" | 82 #include "SkDisplayApply.h" |
83 #include "SkDrawMatrix.h" | 83 #include "SkDrawMatrix.h" |
84 #include "SkPaint.h" | 84 #include "SkPaint.h" |
85 | 85 |
86 class SkShape1DPathEffect : public Sk1DPathEffect { | 86 class SkShape1DPathEffect : public Sk1DPathEffect { |
87 public: | 87 public: |
88 SkShape1DPathEffect(SkDrawShape1DPathEffect* draw, SkAnimateMaker* maker) : | 88 SkShape1DPathEffect(SkDrawShape1DPathEffect* draw, SkAnimateMaker* maker) : |
89 fDraw(draw), fMaker(maker) { | 89 fDraw(draw), fMaker(maker) { |
90 } | 90 } |
91 | 91 |
92 SK_DECLARE_UNFLATTENABLE_OBJECT() | 92 // For serialization. This will never be called. |
| 93 Factory getFactory() const SK_OVERRIDE { sk_throw(); return NULL; } |
93 | 94 |
94 protected: | 95 protected: |
95 virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE { | 96 virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE { |
96 SkScriptValue value; | 97 SkScriptValue value; |
97 SkAnimatorScript engine(*fMaker, NULL, SkType_Float); | 98 SkAnimatorScript engine(*fMaker, NULL, SkType_Float); |
98 engine.propertyCallBack(GetContourLength, &contourLength); | 99 engine.propertyCallBack(GetContourLength, &contourLength); |
99 value.fOperand.fScalar = 0; | 100 value.fOperand.fScalar = 0; |
100 engine.evaluate(fDraw->phase.c_str(), &value, SkType_Float); | 101 engine.evaluate(fDraw->phase.c_str(), &value, SkType_Float); |
101 return value.fOperand.fScalar; | 102 return value.fOperand.fScalar; |
102 } | 103 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 222 } |
222 | 223 |
223 ////////// SkShape2DPathEffect | 224 ////////// SkShape2DPathEffect |
224 | 225 |
225 class SkShape2DPathEffect : public Sk2DPathEffect { | 226 class SkShape2DPathEffect : public Sk2DPathEffect { |
226 public: | 227 public: |
227 SkShape2DPathEffect(SkDrawShape2DPathEffect* draw, SkAnimateMaker* maker, | 228 SkShape2DPathEffect(SkDrawShape2DPathEffect* draw, SkAnimateMaker* maker, |
228 const SkMatrix& matrix) : Sk2DPathEffect(matrix), fDraw(draw), fMaker(ma
ker) { | 229 const SkMatrix& matrix) : Sk2DPathEffect(matrix), fDraw(draw), fMaker(ma
ker) { |
229 } | 230 } |
230 | 231 |
| 232 // For serialization. This will never be called. |
| 233 Factory getFactory() const SK_OVERRIDE { sk_throw(); return NULL; } |
| 234 |
231 protected: | 235 protected: |
232 virtual void begin(const SkIRect& uvBounds, SkPath*) const SK_OVERRIDE { | 236 virtual void begin(const SkIRect& uvBounds, SkPath*) const SK_OVERRIDE { |
233 const_cast<SkShape2DPathEffect*>(this)->setUVBounds(uvBounds); | 237 const_cast<SkShape2DPathEffect*>(this)->setUVBounds(uvBounds); |
234 } | 238 } |
235 | 239 |
236 virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const SK_OV
ERRIDE { | 240 virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) const SK_OV
ERRIDE { |
237 const_cast<SkShape2DPathEffect*>(this)->addPath(loc, u, v, dst); | 241 const_cast<SkShape2DPathEffect*>(this)->addPath(loc, u, v, dst); |
238 } | 242 } |
239 | 243 |
240 private: | 244 private: |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 508 |
505 void InitializeSkExtraPathEffects(SkAnimator* animator) { | 509 void InitializeSkExtraPathEffects(SkAnimator* animator) { |
506 animator->addExtras(new SkExtraPathEffects()); | 510 animator->addExtras(new SkExtraPathEffects()); |
507 } | 511 } |
508 | 512 |
509 //////////////// | 513 //////////////// |
510 | 514 |
511 | 515 |
512 SkExtras::SkExtras() : fExtraCallBack(NULL), fExtraStorage(NULL) { | 516 SkExtras::SkExtras() : fExtraCallBack(NULL), fExtraStorage(NULL) { |
513 } | 517 } |
OLD | NEW |