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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, ti
leSize); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 virtual SkShader::Context* createContext(const ContextRec&, void* storage) c
onst SK_OVERRIDE; | |
76 virtual size_t contextSize() const SK_OVERRIDE; | 75 virtual size_t contextSize() const SK_OVERRIDE; |
77 | 76 |
78 class PerlinNoiseShaderContext : public SkShader::Context { | 77 class PerlinNoiseShaderContext : public SkShader::Context { |
79 public: | 78 public: |
80 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const Contex
tRec&); | 79 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const Contex
tRec&); |
81 virtual ~PerlinNoiseShaderContext() {} | 80 virtual ~PerlinNoiseShaderContext() {} |
82 | 81 |
83 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE
; | 82 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE
; |
84 virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRID
E; | 83 virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRID
E; |
85 | 84 |
(...skipping 11 matching lines...) Expand all Loading... |
97 }; | 96 }; |
98 | 97 |
99 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const S
K_OVERRIDE; | 98 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const S
K_OVERRIDE; |
100 | 99 |
101 SK_TO_STRING_OVERRIDE() | 100 SK_TO_STRING_OVERRIDE() |
102 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader) | 101 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader) |
103 | 102 |
104 protected: | 103 protected: |
105 SkPerlinNoiseShader(SkReadBuffer&); | 104 SkPerlinNoiseShader(SkReadBuffer&); |
106 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 105 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 106 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_
OVERRIDE; |
107 | 107 |
108 private: | 108 private: |
109 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, | 109 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, |
110 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, | 110 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, |
111 const SkISize* tileSize); | 111 const SkISize* tileSize); |
112 virtual ~SkPerlinNoiseShader(); | 112 virtual ~SkPerlinNoiseShader(); |
113 | 113 |
114 // TODO (scroggo): Once all SkShaders are created from a factory, and we hav
e removed the | 114 // TODO (scroggo): Once all SkShaders are created from a factory, and we hav
e removed the |
115 // constructor that creates SkPerlinNoiseShader from an SkReadBuffer, severa
l fields can | 115 // constructor that creates SkPerlinNoiseShader from an SkReadBuffer, severa
l fields can |
116 // be made constant. | 116 // be made constant. |
117 /*const*/ SkPerlinNoiseShader::Type fType; | 117 /*const*/ SkPerlinNoiseShader::Type fType; |
118 /*const*/ SkScalar fBaseFrequencyX; | 118 /*const*/ SkScalar fBaseFrequencyX; |
119 /*const*/ SkScalar fBaseFrequencyY; | 119 /*const*/ SkScalar fBaseFrequencyY; |
120 /*const*/ int fNumOctaves; | 120 /*const*/ int fNumOctaves; |
121 /*const*/ SkScalar fSeed; | 121 /*const*/ SkScalar fSeed; |
122 /*const*/ SkISize fTileSize; | 122 /*const*/ SkISize fTileSize; |
123 /*const*/ bool fStitchTiles; | 123 /*const*/ bool fStitchTiles; |
124 | 124 |
125 PaintingData* fPaintingData; | 125 PaintingData* fPaintingData; |
126 | 126 |
127 typedef SkShader INHERITED; | 127 typedef SkShader INHERITED; |
128 }; | 128 }; |
129 | 129 |
130 #endif | 130 #endif |
OLD | NEW |