Index: src/effects/SkPerlinNoiseShader.cpp |
=================================================================== |
--- src/effects/SkPerlinNoiseShader.cpp (revision 8313) |
+++ src/effects/SkPerlinNoiseShader.cpp (working copy) |
@@ -74,8 +74,8 @@ |
}; |
struct SkPerlinNoiseShader::PaintingData { |
- PaintingData(int paintingSeed, const SkISize& tileSize) |
- : fSeed(paintingSeed) |
+ PaintingData(const SkISize& tileSize) |
+ : fSeed(0) |
, fTileSize(tileSize) |
, fPermutationsBitmap(NULL) |
, fNoiseBitmap(NULL) |
@@ -114,11 +114,12 @@ |
return result; |
} |
- void init() |
+ void init(SkScalar seed) |
{ |
static const SkScalar gInvBlockSizef = SkScalarInvert(SkIntToScalar(kBlockSize)); |
// The seed value clamp to the range [1, kRandMaximum - 1]. |
+ fSeed = SkScalarRoundToInt(seed); |
if (fSeed <= 0) { |
fSeed = -(fSeed % (kRandMaximum - 1)) + 1; |
} |
@@ -319,7 +320,7 @@ |
void SkPerlinNoiseShader::initPaint(PaintingData& paintingData) |
{ |
- paintingData.init(); |
+ paintingData.init(fSeed); |
// Set frequencies to original values |
paintingData.fBaseFrequency.set(fBaseFrequencyX, fBaseFrequencyY); |
@@ -333,7 +334,7 @@ |
fTileSize = tileSize; |
if (NULL == fPaintingData) { |
- fPaintingData = SkNEW_ARGS(PaintingData, (SkScalarRoundToInt(fSeed), fTileSize)); |
+ fPaintingData = SkNEW_ARGS(PaintingData, (fTileSize)); |
initPaint(*fPaintingData); |
} else { |
// Set Size |
@@ -615,6 +616,7 @@ |
GrEffectRef* GrPerlinNoiseEffect::TestCreate(SkMWCRandom* random, |
GrContext* context, |
+ const GrDrawTargetCaps&, |
GrTexture**) { |
int numOctaves = random->nextRangeU(2, 10); |
bool stitchTiles = random->nextBool(); |