Index: src/effects/SkDiscretePathEffect.cpp |
diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp |
index de834424df34fc661638fcbb7026bdc8214571a7..f6f91124479404330b1763370a51a70deb44f76d 100644 |
--- a/src/effects/SkDiscretePathEffect.cpp |
+++ b/src/effects/SkDiscretePathEffect.cpp |
@@ -20,9 +20,10 @@ static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) { |
*p += normal; |
} |
- |
-SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength, SkScalar deviation) |
- : fSegLength(segLength), fPerterb(deviation) |
+SkDiscretePathEffect::SkDiscretePathEffect(SkScalar segLength, |
+ SkScalar deviation, |
+ uint32_t seedAssist) |
+ : fSegLength(segLength), fPerterb(deviation), fSeedAssist(seedAssist) |
{ |
} |
@@ -31,7 +32,10 @@ bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src, |
bool doFill = rec->isFillStyle(); |
SkPathMeasure meas(src, doFill); |
- uint32_t seed = SkScalarRoundToInt(meas.getLength()); |
+ |
+ /* Caller may supply their own seed assist, which by default is 0 */ |
+ uint32_t seed = fSeedAssist ^ SkScalarRoundToInt(meas.getLength()); |
+ |
SkLCGRandom rand(seed ^ ((seed << 16) | (seed >> 16))); |
SkScalar scale = fPerterb; |
SkPoint p; |
@@ -75,9 +79,11 @@ void SkDiscretePathEffect::flatten(SkWriteBuffer& buffer) const { |
this->INHERITED::flatten(buffer); |
buffer.writeScalar(fSegLength); |
buffer.writeScalar(fPerterb); |
+ buffer.writeUInt(fSeedAssist); |
} |
SkDiscretePathEffect::SkDiscretePathEffect(SkReadBuffer& buffer) { |
fSegLength = buffer.readScalar(); |
fPerterb = buffer.readScalar(); |
+ fSeedAssist = buffer.readUInt(); |
} |