| 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 SkPerlinNoiseShader2_DEFINED | 8 #ifndef SkPerlinNoiseShader2_DEFINED |
| 9 #define SkPerlinNoiseShader2_DEFINED | 9 #define SkPerlinNoiseShader2_DEFINED |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 */ | 73 */ |
| 74 static SkShader* CreateImprovedNoise(SkScalar baseFrequencyX, SkScalar baseF
requencyY, | 74 static SkShader* CreateImprovedNoise(SkScalar baseFrequencyX, SkScalar baseF
requencyY, |
| 75 int numOctaves, SkScalar z); | 75 int numOctaves, SkScalar z); |
| 76 /** | 76 /** |
| 77 * Create alias for CreateTurbulunce until all Skia users changed | 77 * Create alias for CreateTurbulunce until all Skia users changed |
| 78 * its code to use the new naming | 78 * its code to use the new naming |
| 79 */ | 79 */ |
| 80 static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequ
encyY, | 80 static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequ
encyY, |
| 81 int numOctaves, SkScalar seed, | 81 int numOctaves, SkScalar seed, |
| 82 const SkISize* tileSize = NULL) { | 82 const SkISize* tileSize = NULL) { |
| 83 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed
, tileSize); | 83 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, ti
leSize); |
| 84 } | 84 } |
| 85 | 85 |
| 86 |
| 87 size_t contextSize(const ContextRec&) const override; |
| 88 |
| 86 class PerlinNoiseShaderContext : public SkShader::Context { | 89 class PerlinNoiseShaderContext : public SkShader::Context { |
| 87 public: | 90 public: |
| 88 PerlinNoiseShaderContext(const SkPerlinNoiseShader2& shader, const Conte
xtRec&); | 91 PerlinNoiseShaderContext(const SkPerlinNoiseShader2& shader, const Conte
xtRec&); |
| 89 virtual ~PerlinNoiseShaderContext(); | 92 virtual ~PerlinNoiseShaderContext(); |
| 90 | 93 |
| 91 void shadeSpan(int x, int y, SkPMColor[], int count) override; | 94 void shadeSpan(int x, int y, SkPMColor[], int count) override; |
| 92 | 95 |
| 93 private: | 96 private: |
| 94 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; | 97 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; |
| 95 SkScalar calculateTurbulenceValueForPoint( | 98 SkScalar calculateTurbulenceValueForPoint( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 108 #if SK_SUPPORT_GPU | 111 #if SK_SUPPORT_GPU |
| 109 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, | 112 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, |
| 110 const SkMatrix*, SkFilterQual
ity) const override; | 113 const SkMatrix*, SkFilterQual
ity) const override; |
| 111 #endif | 114 #endif |
| 112 | 115 |
| 113 SK_TO_STRING_OVERRIDE() | 116 SK_TO_STRING_OVERRIDE() |
| 114 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader2) | 117 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader2) |
| 115 | 118 |
| 116 protected: | 119 protected: |
| 117 void flatten(SkWriteBuffer&) const override; | 120 void flatten(SkWriteBuffer&) const override; |
| 118 size_t onContextSize(const ContextRec&) const override; | |
| 119 Context* onCreateContext(const ContextRec&, void* storage) const override; | 121 Context* onCreateContext(const ContextRec&, void* storage) const override; |
| 120 | 122 |
| 121 private: | 123 private: |
| 122 SkPerlinNoiseShader2(SkPerlinNoiseShader2::Type type, SkScalar baseFrequency
X, | 124 SkPerlinNoiseShader2(SkPerlinNoiseShader2::Type type, SkScalar baseFrequency
X, |
| 123 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, | 125 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, |
| 124 const SkISize* tileSize); | 126 const SkISize* tileSize); |
| 125 virtual ~SkPerlinNoiseShader2(); | 127 virtual ~SkPerlinNoiseShader2(); |
| 126 | 128 |
| 127 const SkPerlinNoiseShader2::Type fType; | 129 const SkPerlinNoiseShader2::Type fType; |
| 128 const SkScalar fBaseFrequencyX; | 130 const SkScalar fBaseFrequencyX; |
| 129 const SkScalar fBaseFrequencyY; | 131 const SkScalar fBaseFrequencyY; |
| 130 const int fNumOctaves; | 132 const int fNumOctaves; |
| 131 const SkScalar fSeed; | 133 const SkScalar fSeed; |
| 132 const SkISize fTileSize; | 134 const SkISize fTileSize; |
| 133 const bool fStitchTiles; | 135 const bool fStitchTiles; |
| 134 | 136 |
| 135 typedef SkShader INHERITED; | 137 typedef SkShader INHERITED; |
| 136 }; | 138 }; |
| 137 | 139 |
| 138 #endif | 140 #endif |
| OLD | NEW |