diff options
author | humper@google.com <humper@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-04 19:23:53 +0000 |
---|---|---|
committer | humper@google.com <humper@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-04 19:23:53 +0000 |
commit | 3aad3b01afc77993ff051c02e49186294e312980 (patch) | |
tree | 2ea966765798c8e402b0cef6ec2399ba12ed0f37 /src/gpu/effects/GrBicubicEffect.h | |
parent | f0595b39a97a1c53e47e179a8ee4fa35d9f00fa0 (diff) |
add support for high quality image filtering on the GPU
R=bsalomon@google.com, reed@google.com
Review URL: https://codereview.chromium.org/23779003
git-svn-id: http://skia.googlecode.com/svn/trunk@11087 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrBicubicEffect.h')
-rw-r--r-- | src/gpu/effects/GrBicubicEffect.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h new file mode 100644 index 0000000000..618ef1a779 --- /dev/null +++ b/src/gpu/effects/GrBicubicEffect.h @@ -0,0 +1,69 @@ +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrBicubicTextureEffect_DEFINED +#define GrBicubicTextureEffect_DEFINED + +#include "GrSingleTextureEffect.h" +#include "GrDrawEffect.h" +#include "gl/GrGLEffect.h" +#include "gl/GrGLEffectMatrix.h" +#include "GrTBackendEffectFactory.h" + +class GrGLBicubicEffect; + +class GrBicubicEffect : public GrSingleTextureEffect { +public: + virtual ~GrBicubicEffect(); + + static const char* Name() { return "Bicubic"; } + const float* coefficients() const { return fCoefficients; } + + typedef GrGLBicubicEffect GLEffect; + + virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; + virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; + + static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) { + AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients))); + return CreateEffectRef(effect); + } + + static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16], + const SkMatrix& matrix, + const GrTextureParams& p, + CoordsType coordsType = kLocal_CoordsType) { + AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, p, coordsType))); + return CreateEffectRef(effect); + } + + static GrEffectRef* Create(GrTexture* tex) { + return Create(tex, gMitchellCoefficients); + } + + static GrEffectRef* Create(GrTexture* tex, + const SkMatrix& matrix, + const GrTextureParams& p, + CoordsType coordsType = kLocal_CoordsType) { + return Create(tex, gMitchellCoefficients, matrix, p, coordsType); + } + +private: + GrBicubicEffect(GrTexture*, const SkScalar coefficients[16]); + GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], + const SkMatrix &matrix, const GrTextureParams &p, CoordsType coordsType); + virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; + float fCoefficients[16]; + + GR_DECLARE_EFFECT_TEST; + + static const SkScalar gMitchellCoefficients[16]; + + typedef GrSingleTextureEffect INHERITED; +}; + +#endif |