OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "GrConvolutionEffect.h" | 8 #include "GrConvolutionEffect.h" |
9 #include "glsl/GrGLSLFragmentProcessor.h" | 9 #include "glsl/GrGLSLFragmentProcessor.h" |
10 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 10 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
11 #include "glsl/GrGLSLProgramDataManager.h" | 11 #include "glsl/GrGLSLProgramDataManager.h" |
12 #include "glsl/GrGLSLUniformHandler.h" | 12 #include "glsl/GrGLSLUniformHandler.h" |
13 | 13 |
14 // For brevity | 14 // For brevity |
15 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 15 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
16 | 16 |
17 class GrGLConvolutionEffect : public GrGLSLFragmentProcessor { | 17 class GrGLConvolutionEffect : public GrGLSLFragmentProcessor { |
18 public: | 18 public: |
19 GrGLConvolutionEffect(const GrProcessor&); | 19 GrGLConvolutionEffect(const GrProcessor&); |
20 | 20 |
21 virtual void emitCode(EmitArgs&) override; | 21 void emitCode(EmitArgs&) override; |
22 | 22 |
23 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder*); | 23 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder*); |
24 | 24 |
25 protected: | 25 protected: |
26 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor&) ov
erride; | 26 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor&) ov
erride; |
27 | 27 |
28 private: | 28 private: |
29 int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); } | 29 int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); } |
30 bool useBounds() const { return fUseBounds; } | 30 bool useBounds() const { return fUseBounds; } |
31 Gr1DKernelEffect::Direction direction() const { return fDirection; } | 31 Gr1DKernelEffect::Direction direction() const { return fDirection; } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 | 233 |
234 bool useBounds = d->fRandom->nextBool(); | 234 bool useBounds = d->fRandom->nextBool(); |
235 return GrConvolutionEffect::Create(d->fTextures[texIdx], | 235 return GrConvolutionEffect::Create(d->fTextures[texIdx], |
236 dir, | 236 dir, |
237 radius, | 237 radius, |
238 kernel, | 238 kernel, |
239 useBounds, | 239 useBounds, |
240 bounds); | 240 bounds); |
241 } | 241 } |
OLD | NEW |