blob: e3c3aa9c2071cc9e1de9f9d33aa120f71e9f3bd4 [file] [log] [blame]
tomhudson@google.comd8f856c2012-05-10 12:13:36 +00001/*
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
14class GrConvolutionEffect : public GrCustomStage {
15
16public:
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
28protected:
29
30 GrSamplerState::FilterDirection fDirection;
31 unsigned int fKernelWidth;
32 float fKernel[MAX_KERNEL_WIDTH];
33
34 friend class GrGLConvolutionEffect;
35
36private:
37
38 typedef GrCustomStage INHERITED;
39};
40
41#endif