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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 protected: | 75 protected: |
76 SkPerlinNoiseShader(SkReadBuffer&); | 76 SkPerlinNoiseShader(SkReadBuffer&); |
77 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 77 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
78 | 78 |
79 private: | 79 private: |
80 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, | 80 SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX, |
81 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, | 81 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, |
82 const SkISize* tileSize = NULL); | 82 const SkISize* tileSize = NULL); |
83 virtual ~SkPerlinNoiseShader(); | 83 virtual ~SkPerlinNoiseShader(); |
84 | 84 |
85 void setTileSize(const SkISize&); | |
86 | |
87 void initPaint(PaintingData& paintingData); | |
88 | |
89 SkScalar noise2D(int channel, const PaintingData& paintingData, | 85 SkScalar noise2D(int channel, const PaintingData& paintingData, |
90 const StitchData& stitchData, const SkPoint& noiseVector); | 86 const StitchData& stitchData, const SkPoint& noiseVector); |
91 | 87 |
92 SkScalar calculateTurbulenceValueForPoint(int channel, const PaintingData& p aintingData, | 88 SkScalar calculateTurbulenceValueForPoint(int channel, const PaintingData& p aintingData, |
93 StitchData& stitchData, const SkPo int& point); | 89 StitchData& stitchData, const SkPo int& point); |
94 | 90 |
95 SkPMColor shade(const SkPoint& point, StitchData& stitchData); | 91 SkPMColor shade(const SkPoint& point, StitchData& stitchData); |
96 | 92 |
97 SkPerlinNoiseShader::Type fType; | 93 // TODO (scroggo): Once all SkShaders are created from a factory, and we hav e removed the |
98 SkScalar fBaseFrequencyX; | 94 // constructor that creates SkPerlinNoiseShader from an SkReadBuffer, severa l fields can |
99 SkScalar fBaseFrequencyY; | 95 // be made constant. |
Dominik Grewe
2014/02/18 15:00:33
Is it always feasible to make all fields const? If
scroggo
2014/02/18 16:42:57
I don't know of any other way to make them immutab
| |
100 int fNumOctaves; | 96 /*const*/ SkPerlinNoiseShader::Type fType; |
101 SkScalar fSeed; | 97 /*const*/ SkScalar fBaseFrequencyX; |
102 SkISize fTileSize; | 98 /*const*/ SkScalar fBaseFrequencyY; |
103 bool fStitchTiles; | 99 /*const*/ int fNumOctaves; |
100 /*const*/ SkScalar fSeed; | |
101 /*const*/ SkISize fTileSize; | |
102 /*const*/ bool fStitchTiles; | |
103 // TODO (scroggo): Once setContext creates a new object, place this on that object. | |
104 SkMatrix fMatrix; | 104 SkMatrix fMatrix; |
105 | 105 |
106 PaintingData* fPaintingData; | 106 PaintingData* fPaintingData; |
107 | 107 |
108 typedef SkShader INHERITED; | 108 typedef SkShader INHERITED; |
109 }; | 109 }; |
110 | 110 |
111 #endif | 111 #endif |
OLD | NEW |