Index: src/effects/SkPerlinNoiseShader.cpp |
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp |
index 1400905bfe61d42c26839599bb8af4faa8d3939f..2268d4e1d5ed31d904eabd656aa8b0059d920585 100644 |
--- a/src/effects/SkPerlinNoiseShader.cpp |
+++ b/src/effects/SkPerlinNoiseShader.cpp |
@@ -275,12 +275,12 @@ SkPerlinNoiseShader::SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, |
: fType(type) |
, fBaseFrequencyX(baseFrequencyX) |
, fBaseFrequencyY(baseFrequencyY) |
- , fNumOctaves(numOctaves > 255 ? 255 : numOctaves/*[0,255] octaves allowed*/) |
+ , fNumOctaves(SkTPin<int>(numOctaves, 0, 255)) // [0,255] octaves allowed |
, fSeed(seed) |
, fTileSize(nullptr == tileSize ? SkISize::Make(0, 0) : *tileSize) |
, fStitchTiles(!fTileSize.isEmpty()) |
{ |
- SkASSERT(numOctaves >= 0 && numOctaves < 256); |
+ SkASSERT(fNumOctaves >= 0 && fNumOctaves < 256); |
} |
SkPerlinNoiseShader::~SkPerlinNoiseShader() { |