| 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 "gl/GrGLProcessor.h" | 9 #include "gl/GrGLProcessor.h" |
| 10 #include "gl/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
| 11 #include "gl/GrGLTexture.h" | 11 #include "gl/GrGLTexture.h" |
| 12 #include "gl/builders/GrGLProgramBuilder.h" | 12 #include "gl/builders/GrGLProgramBuilder.h" |
| 13 | 13 |
| 14 // For brevity | 14 // For brevity |
| 15 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 15 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
| 16 | 16 |
| 17 class GrGLConvolutionEffect : public GrGLFragmentProcessor { | 17 class GrGLConvolutionEffect : public GrGLFragmentProcessor { |
| 18 public: | 18 public: |
| 19 GrGLConvolutionEffect(const GrProcessor&); | 19 GrGLConvolutionEffect(const GrProcessor&); |
| 20 | 20 |
| 21 virtual void emitCode(GrGLFPBuilder*, | 21 virtual void emitCode(GrGLFPBuilder*, |
| 22 const GrFragmentProcessor&, | 22 const GrFragmentProcessor&, |
| 23 const char* outputColor, | 23 const char* outputColor, |
| 24 const char* inputColor, | 24 const char* inputColor, |
| 25 const TransformedCoordsArray&, | 25 const TransformedCoordsArray&, |
| 26 const TextureSamplerArray&) SK_OVERRIDE; | 26 const TextureSamplerArray&) override; |
| 27 | 27 |
| 28 void setData(const GrGLProgramDataManager& pdman, const GrProcessor&) SK_OVE
RRIDE; | 28 void setData(const GrGLProgramDataManager& pdman, const GrProcessor&) overri
de; |
| 29 | 29 |
| 30 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 30 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); } | 33 int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); } |
| 34 bool useBounds() const { return fUseBounds; } | 34 bool useBounds() const { return fUseBounds; } |
| 35 Gr1DKernelEffect::Direction direction() const { return fDirection; } | 35 Gr1DKernelEffect::Direction direction() const { return fDirection; } |
| 36 | 36 |
| 37 int fRadius; | 37 int fRadius; |
| 38 bool fUseBounds; | 38 bool fUseBounds; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 236 } |
| 237 | 237 |
| 238 bool useBounds = random->nextBool(); | 238 bool useBounds = random->nextBool(); |
| 239 return GrConvolutionEffect::Create(textures[texIdx], | 239 return GrConvolutionEffect::Create(textures[texIdx], |
| 240 dir, | 240 dir, |
| 241 radius, | 241 radius, |
| 242 kernel, | 242 kernel, |
| 243 useBounds, | 243 useBounds, |
| 244 bounds); | 244 bounds); |
| 245 } | 245 } |
| OLD | NEW |