| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkPerlinNoiseShader_DEFINED | 8 #ifndef SkPerlinNoiseShader_DEFINED |
| 9 #define SkPerlinNoiseShader_DEFINED | 9 #define SkPerlinNoiseShader_DEFINED |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 static SkShader* CreateTurbulence(SkScalar baseFrequencyX, SkScalar baseFreq
uencyY, | 61 static SkShader* CreateTurbulence(SkScalar baseFrequencyX, SkScalar baseFreq
uencyY, |
| 62 int numOctaves, SkScalar seed, | 62 int numOctaves, SkScalar seed, |
| 63 const SkISize* tileSize = NULL); | 63 const SkISize* tileSize = NULL); |
| 64 /** | 64 /** |
| 65 * Create alias for CreateTurbulunce until all Skia users changed | 65 * Create alias for CreateTurbulunce until all Skia users changed |
| 66 * its code to use the new naming | 66 * its code to use the new naming |
| 67 */ | 67 */ |
| 68 static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequ
encyY, | 68 static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequ
encyY, |
| 69 int numOctaves, SkScalar seed, | 69 int numOctaves, SkScalar seed, |
| 70 const SkISize* tileSize = NULL) { | 70 const SkISize* tileSize = NULL) { |
| 71 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, ti
leSize); | 71 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed
, tileSize); |
| 72 } | 72 } |
| 73 | 73 |
| 74 | |
| 75 size_t contextSize(const ContextRec&) const override; | |
| 76 | |
| 77 class PerlinNoiseShaderContext : public SkShader::Context { | 74 class PerlinNoiseShaderContext : public SkShader::Context { |
| 78 public: | 75 public: |
| 79 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const Contex
tRec&); | 76 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const Contex
tRec&); |
| 80 virtual ~PerlinNoiseShaderContext(); | 77 virtual ~PerlinNoiseShaderContext(); |
| 81 | 78 |
| 82 void shadeSpan(int x, int y, SkPMColor[], int count) override; | 79 void shadeSpan(int x, int y, SkPMColor[], int count) override; |
| 83 | 80 |
| 84 private: | 81 private: |
| 85 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; | 82 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; |
| 86 SkScalar calculateTurbulenceValueForPoint( | 83 SkScalar calculateTurbulenceValueForPoint( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 99 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, | 96 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, |
| 100 const SkMatrix*, SkFilterQual
ity) const override; | 97 const SkMatrix*, SkFilterQual
ity) const override; |
| 101 #endif | 98 #endif |
| 102 | 99 |
| 103 SK_TO_STRING_OVERRIDE() | 100 SK_TO_STRING_OVERRIDE() |
| 104 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader) | 101 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader) |
| 105 | 102 |
| 106 protected: | 103 protected: |
| 107 void flatten(SkWriteBuffer&) const override; | 104 void flatten(SkWriteBuffer&) const override; |
| 108 Context* onCreateContext(const ContextRec&, void* storage) const override; | 105 Context* onCreateContext(const ContextRec&, void* storage) const override; |
| 106 size_t onContextSize(const ContextRec&) const override; |
| 109 | 107 |
| 110 private: | 108 private: |
| 111 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, | 109 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, |
| 112 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, | 110 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, |
| 113 const SkISize* tileSize); | 111 const SkISize* tileSize); |
| 114 virtual ~SkPerlinNoiseShader(); | 112 virtual ~SkPerlinNoiseShader(); |
| 115 | 113 |
| 116 const SkPerlinNoiseShader::Type fType; | 114 const SkPerlinNoiseShader::Type fType; |
| 117 const SkScalar fBaseFrequencyX; | 115 const SkScalar fBaseFrequencyX; |
| 118 const SkScalar fBaseFrequencyY; | 116 const SkScalar fBaseFrequencyY; |
| 119 const int fNumOctaves; | 117 const int fNumOctaves; |
| 120 const SkScalar fSeed; | 118 const SkScalar fSeed; |
| 121 const SkISize fTileSize; | 119 const SkISize fTileSize; |
| 122 const bool fStitchTiles; | 120 const bool fStitchTiles; |
| 123 | 121 |
| 124 typedef SkShader INHERITED; | 122 typedef SkShader INHERITED; |
| 125 }; | 123 }; |
| 126 | 124 |
| 127 #endif | 125 #endif |
| OLD | NEW |