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( | 75 virtual SkShader::Context* createContext(const ContextRec&, void* storage) c
onst SK_OVERRIDE; |
76 const SkBitmap& device, const SkPaint& paint, | |
77 const SkMatrix& matrix, void* storage) const SK_OVERRIDE; | |
78 virtual size_t contextSize() const SK_OVERRIDE; | 76 virtual size_t contextSize() const SK_OVERRIDE; |
79 | 77 |
80 class PerlinNoiseShaderContext : public SkShader::Context { | 78 class PerlinNoiseShaderContext : public SkShader::Context { |
81 public: | 79 public: |
82 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const SkBitm
ap& device, | 80 PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const Contex
tRec&); |
83 const SkPaint& paint, const SkMatrix& matrix); | |
84 virtual ~PerlinNoiseShaderContext() {} | 81 virtual ~PerlinNoiseShaderContext() {} |
85 | 82 |
86 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE
; | 83 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE
; |
87 virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRID
E; | 84 virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRID
E; |
88 | 85 |
89 private: | 86 private: |
90 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; | 87 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; |
91 SkScalar calculateTurbulenceValueForPoint( | 88 SkScalar calculateTurbulenceValueForPoint( |
92 int channel, const PaintingData& paintingData, | 89 int channel, const PaintingData& paintingData, |
93 StitchData& stitchData, const SkPoint& point) const; | 90 StitchData& stitchData, const SkPoint& point) const; |
(...skipping 30 matching lines...) Expand all Loading... |
124 /*const*/ SkScalar fSeed; | 121 /*const*/ SkScalar fSeed; |
125 /*const*/ SkISize fTileSize; | 122 /*const*/ SkISize fTileSize; |
126 /*const*/ bool fStitchTiles; | 123 /*const*/ bool fStitchTiles; |
127 | 124 |
128 PaintingData* fPaintingData; | 125 PaintingData* fPaintingData; |
129 | 126 |
130 typedef SkShader INHERITED; | 127 typedef SkShader INHERITED; |
131 }; | 128 }; |
132 | 129 |
133 #endif | 130 #endif |
OLD | NEW |