Chromium Code Reviews| 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 #ifndef SkDiscretePathEffect_DEFINED | 8 #ifndef SkDiscretePathEffect_DEFINED |
| 9 #define SkDiscretePathEffect_DEFINED | 9 #define SkDiscretePathEffect_DEFINED |
| 10 | 10 |
| 11 #include "SkPathEffect.h" | 11 #include "SkPathEffect.h" |
| 12 | 12 |
| 13 /** \class SkDiscretePathEffect | 13 /** \class SkDiscretePathEffect |
| 14 | 14 |
| 15 This path effect chops a path into discrete segments, and randomly displaces them. | 15 This path effect chops a path into discrete segments, and randomly displaces them. |
| 16 */ | 16 */ |
| 17 class SK_API SkDiscretePathEffect : public SkPathEffect { | 17 class SK_API SkDiscretePathEffect : public SkPathEffect { |
| 18 public: | 18 public: |
| 19 /** Break the path into segments of segLength length, and randomly move the endpoints | 19 /** Break the path into segments of segLength length, and randomly move the endpoints |
| 20 away from the original path by a maximum of deviation. | 20 away from the original path by a maximum of deviation. |
| 21 Note: works on filled or framed paths | 21 Note: works on filled or framed paths |
| 22 */ | 22 */ |
| 23 static SkDiscretePathEffect* Create(SkScalar segLength, SkScalar deviation) { | 23 static SkDiscretePathEffect* Create(SkScalar segLength, |
| 24 return SkNEW_ARGS(SkDiscretePathEffect, (segLength, deviation)); | 24 SkScalar deviation, |
| 25 uint32_t seedAssist=1) { | |
|
scroggo
2014/06/09 14:01:04
Please add a comment explaining what seedAssist do
rs.prinja
2014/06/11 04:15:16
Done.
| |
| 26 return SkNEW_ARGS(SkDiscretePathEffect, | |
| 27 (segLength, deviation, seedAssist)); | |
| 25 } | 28 } |
| 26 | 29 |
| 27 virtual bool filterPath(SkPath* dst, const SkPath& src, | 30 virtual bool filterPath(SkPath* dst, const SkPath& src, |
| 28 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; | 31 SkStrokeRec*, const SkRect*) const SK_OVERRIDE; |
| 29 | 32 |
| 30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect) | 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect) |
| 31 | 34 |
| 32 protected: | 35 protected: |
| 33 SkDiscretePathEffect(SkScalar segLength, SkScalar deviation); | 36 SkDiscretePathEffect(SkScalar segLength, |
| 37 SkScalar deviation, | |
| 38 uint32_t seedAssist); | |
| 34 explicit SkDiscretePathEffect(SkReadBuffer&); | 39 explicit SkDiscretePathEffect(SkReadBuffer&); |
| 35 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 40 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 36 | 41 |
| 37 private: | 42 private: |
| 38 SkScalar fSegLength, fPerterb; | 43 SkScalar fSegLength, fPerterb; |
| 39 | 44 |
| 45 /* Caller-supplied 32 bit seed assist */ | |
| 46 uint32_t fSeedAssist; | |
| 47 | |
| 40 typedef SkPathEffect INHERITED; | 48 typedef SkPathEffect INHERITED; |
| 41 }; | 49 }; |
| 42 | 50 |
| 43 #endif | 51 #endif |
| OLD | NEW |