Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 13047005: New SVG turbulence in Skia (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/effects/SkPerlinNoiseShader.h ('k') | src/ports/SkGlobalInitialization_default.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « include/effects/SkPerlinNoiseShader.h ('k') | src/ports/SkGlobalInitialization_default.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698