Index: src/effects/SkPerlinNoiseShader.cpp |
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp |
index 8c608fa0366c134dae85d1a4d2178be59dd9a1d5..019258972dbda909c92cb1c214ad22dc35406d32 100644 |
--- a/src/effects/SkPerlinNoiseShader.cpp |
+++ b/src/effects/SkPerlinNoiseShader.cpp |
@@ -49,6 +49,11 @@ |
// returns t * t * (3 - 2 * t) |
return SkScalarMul(SkScalarSquare(t), SK_Scalar3 - 2 * t); |
+} |
+ |
+bool perlin_noise_type_is_valid(SkPerlinNoiseShader::Type type) { |
+ return (SkPerlinNoiseShader::kFractalNoise_Type == type) || |
+ (SkPerlinNoiseShader::kTurbulence_Type == type); |
} |
} // end namespace |
@@ -282,6 +287,22 @@ |
{ |
SkASSERT(numOctaves >= 0 && numOctaves < 256); |
} |
+ |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkPerlinNoiseShader::SkPerlinNoiseShader(SkReadBuffer& buffer) : INHERITED(buffer) { |
+ fType = (SkPerlinNoiseShader::Type) buffer.readInt(); |
+ fBaseFrequencyX = buffer.readScalar(); |
+ fBaseFrequencyY = buffer.readScalar(); |
+ fNumOctaves = buffer.readInt(); |
+ fSeed = buffer.readScalar(); |
+ fStitchTiles = buffer.readBool(); |
+ fTileSize.fWidth = buffer.readInt(); |
+ fTileSize.fHeight = buffer.readInt(); |
+ buffer.validate(perlin_noise_type_is_valid(fType) && |
+ (fNumOctaves >= 0) && (fNumOctaves <= 255) && |
+ (fStitchTiles != fTileSize.isEmpty())); |
+} |
+#endif |
SkPerlinNoiseShader::~SkPerlinNoiseShader() { |
} |
@@ -943,7 +964,7 @@ |
const SkMatrix* externalLocalMatrix, |
GrColor* paintColor, GrFragmentProcessor** fp) const { |
SkASSERT(context); |
- |
+ |
*paintColor = SkColor2GrColorJustAlpha(paint.getColor()); |
SkMatrix localMatrix = this->getLocalMatrix(); |