| tomhudson@google.com | d8f856c | 2012-05-10 12:13:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef GrConvolutionEffect_DEFINED |
| 9 | #define GrConvolutionEffect_DEFINED |
| 10 | |
| 11 | #include "GrCustomStage.h" |
| 12 | #include "GrSamplerState.h" // for MAX_KENEL_WIDTH, FilterDirection |
| 13 | |
| 14 | class GrConvolutionEffect : public GrCustomStage { |
| 15 | |
| 16 | public: |
| 17 | |
| 18 | GrConvolutionEffect(GrSamplerState::FilterDirection direction, |
| 19 | unsigned int kernelWidth, const float* kernel); |
| 20 | virtual ~GrConvolutionEffect(); |
| 21 | |
| 22 | virtual const char* name() const SK_OVERRIDE; |
| 23 | virtual GrProgramStageFactory* getFactory() const SK_OVERRIDE; |
| 24 | virtual bool isEqual(const GrCustomStage *) const SK_OVERRIDE; |
| 25 | |
| 26 | unsigned int width() const { return fKernelWidth; } |
| 27 | |
| 28 | protected: |
| 29 | |
| 30 | GrSamplerState::FilterDirection fDirection; |
| 31 | unsigned int fKernelWidth; |
| 32 | float fKernel[MAX_KERNEL_WIDTH]; |
| 33 | |
| 34 | friend class GrGLConvolutionEffect; |
| 35 | |
| 36 | private: |
| 37 | |
| 38 | typedef GrCustomStage INHERITED; |
| 39 | }; |
| 40 | |
| 41 | #endif |