| 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/GrGLEffect.h" |    9 #include "gl/GrGLEffect.h" | 
|   10 #include "gl/GrGLEffectMatrix.h" |   10 #include "gl/GrGLEffectMatrix.h" | 
|   11 #include "gl/GrGLSL.h" |   11 #include "gl/GrGLSL.h" | 
|   12 #include "gl/GrGLTexture.h" |   12 #include "gl/GrGLTexture.h" | 
|   13 #include "GrTBackendEffectFactory.h" |   13 #include "GrTBackendEffectFactory.h" | 
|   14  |   14  | 
|   15 // For brevity |   15 // For brevity | 
|   16 typedef GrGLUniformManager::UniformHandle UniformHandle; |   16 typedef GrGLUniformManager::UniformHandle UniformHandle; | 
|   17 static const UniformHandle kInvalidUniformHandle = GrGLUniformManager::kInvalidU
     niformHandle; |  | 
|   18  |   17  | 
|   19 class GrGLConvolutionEffect : public GrGLEffect { |   18 class GrGLConvolutionEffect : public GrGLEffect { | 
|   20 public: |   19 public: | 
|   21     GrGLConvolutionEffect(const GrBackendEffectFactory&, const GrDrawEffect&); |   20     GrGLConvolutionEffect(const GrBackendEffectFactory&, const GrDrawEffect&); | 
|   22  |   21  | 
|   23     virtual void emitCode(GrGLShaderBuilder*, |   22     virtual void emitCode(GrGLShaderBuilder*, | 
|   24                           const GrDrawEffect&, |   23                           const GrDrawEffect&, | 
|   25                           EffectKey, |   24                           EffectKey, | 
|   26                           const char* outputColor, |   25                           const char* outputColor, | 
|   27                           const char* inputColor, |   26                           const char* inputColor, | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
|   43     UniformHandle       fImageIncrementUni; |   42     UniformHandle       fImageIncrementUni; | 
|   44     UniformHandle       fBoundsUni; |   43     UniformHandle       fBoundsUni; | 
|   45     GrGLEffectMatrix    fEffectMatrix; |   44     GrGLEffectMatrix    fEffectMatrix; | 
|   46  |   45  | 
|   47     typedef GrGLEffect INHERITED; |   46     typedef GrGLEffect INHERITED; | 
|   48 }; |   47 }; | 
|   49  |   48  | 
|   50 GrGLConvolutionEffect::GrGLConvolutionEffect(const GrBackendEffectFactory& facto
     ry, |   49 GrGLConvolutionEffect::GrGLConvolutionEffect(const GrBackendEffectFactory& facto
     ry, | 
|   51                                              const GrDrawEffect& drawEffect) |   50                                              const GrDrawEffect& drawEffect) | 
|   52     : INHERITED(factory) |   51     : INHERITED(factory) | 
|   53     , fKernelUni(kInvalidUniformHandle) |  | 
|   54     , fImageIncrementUni(kInvalidUniformHandle) |  | 
|   55     , fBoundsUni(kInvalidUniformHandle) |  | 
|   56     , fEffectMatrix(drawEffect.castEffect<GrConvolutionEffect>().coordsType()) { |   52     , fEffectMatrix(drawEffect.castEffect<GrConvolutionEffect>().coordsType()) { | 
|   57     const GrConvolutionEffect& c = drawEffect.castEffect<GrConvolutionEffect>(); |   53     const GrConvolutionEffect& c = drawEffect.castEffect<GrConvolutionEffect>(); | 
|   58     fRadius = c.radius(); |   54     fRadius = c.radius(); | 
|   59     fUseBounds = c.useBounds(); |   55     fUseBounds = c.useBounds(); | 
|   60     fDirection = c.direction(); |   56     fDirection = c.direction(); | 
|   61 } |   57 } | 
|   62  |   58  | 
|   63 void GrGLConvolutionEffect::emitCode(GrGLShaderBuilder* builder, |   59 void GrGLConvolutionEffect::emitCode(GrGLShaderBuilder* builder, | 
|   64                                      const GrDrawEffect&, |   60                                      const GrDrawEffect&, | 
|   65                                      EffectKey key, |   61                                      EffectKey key, | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  241     } |  237     } | 
|  242  |  238  | 
|  243     bool useBounds = random->nextBool(); |  239     bool useBounds = random->nextBool(); | 
|  244     return GrConvolutionEffect::Create(textures[texIdx], |  240     return GrConvolutionEffect::Create(textures[texIdx], | 
|  245                                        dir, |  241                                        dir, | 
|  246                                        radius, |  242                                        radius, | 
|  247                                        kernel, |  243                                        kernel, | 
|  248                                        useBounds, |  244                                        useBounds, | 
|  249                                        bounds); |  245                                        bounds); | 
|  250 } |  246 } | 
| OLD | NEW |