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
, tileSize); | 71 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, ti
leSize); |
72 } | 72 } |
73 | 73 |
| 74 |
| 75 size_t contextSize(const ContextRec&) const override; |
| 76 |
74 class PerlinNoiseShaderContext : public SkShader::Context { | 77 class PerlinNoiseShaderContext : public SkShader::Context { |
75 public: | 78 public: |
76 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const Contex
tRec&); | 79 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const Contex
tRec&); |
77 virtual ~PerlinNoiseShaderContext(); | 80 virtual ~PerlinNoiseShaderContext(); |
78 | 81 |
79 void shadeSpan(int x, int y, SkPMColor[], int count) override; | 82 void shadeSpan(int x, int y, SkPMColor[], int count) override; |
80 | 83 |
81 private: | 84 private: |
82 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; | 85 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; |
83 SkScalar calculateTurbulenceValueForPoint( | 86 SkScalar calculateTurbulenceValueForPoint( |
(...skipping 12 matching lines...) Expand all Loading... |
96 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, | 99 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM
atrix& viewM, |
97 const SkMatrix*, SkFilterQual
ity) const override; | 100 const SkMatrix*, SkFilterQual
ity) const override; |
98 #endif | 101 #endif |
99 | 102 |
100 SK_TO_STRING_OVERRIDE() | 103 SK_TO_STRING_OVERRIDE() |
101 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader) | 104 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader) |
102 | 105 |
103 protected: | 106 protected: |
104 void flatten(SkWriteBuffer&) const override; | 107 void flatten(SkWriteBuffer&) const override; |
105 Context* onCreateContext(const ContextRec&, void* storage) const override; | 108 Context* onCreateContext(const ContextRec&, void* storage) const override; |
106 size_t onContextSize(const ContextRec&) const override; | |
107 | 109 |
108 private: | 110 private: |
109 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, | 111 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, |
110 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, | 112 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, |
111 const SkISize* tileSize); | 113 const SkISize* tileSize); |
112 virtual ~SkPerlinNoiseShader(); | 114 virtual ~SkPerlinNoiseShader(); |
113 | 115 |
114 const SkPerlinNoiseShader::Type fType; | 116 const SkPerlinNoiseShader::Type fType; |
115 const SkScalar fBaseFrequencyX; | 117 const SkScalar fBaseFrequencyX; |
116 const SkScalar fBaseFrequencyY; | 118 const SkScalar fBaseFrequencyY; |
117 const int fNumOctaves; | 119 const int fNumOctaves; |
118 const SkScalar fSeed; | 120 const SkScalar fSeed; |
119 const SkISize fTileSize; | 121 const SkISize fTileSize; |
120 const bool fStitchTiles; | 122 const bool fStitchTiles; |
121 | 123 |
122 typedef SkShader INHERITED; | 124 typedef SkShader INHERITED; |
123 }; | 125 }; |
124 | 126 |
125 #endif | 127 #endif |
OLD | NEW |