| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef GrBicubicTextureEffect_DEFINED | 8 #ifndef GrBicubicTextureEffect_DEFINED |
| 9 #define GrBicubicTextureEffect_DEFINED | 9 #define GrBicubicTextureEffect_DEFINED |
| 10 | 10 |
| 11 #include "GrSingleTextureEffect.h" | 11 #include "GrSingleTextureEffect.h" |
| 12 #include "GrTextureDomain.h" | 12 #include "GrTextureDomain.h" |
| 13 #include "gl/GrGLProcessor.h" | 13 #include "gl/GrGLProcessor.h" |
| 14 #include "GrTBackendProcessorFactory.h" | |
| 15 | 14 |
| 16 class GrGLBicubicEffect; | 15 class GrGLBicubicEffect; |
| 17 class GrInvariantOutput; | 16 class GrInvariantOutput; |
| 18 | 17 |
| 19 class GrBicubicEffect : public GrSingleTextureEffect { | 18 class GrBicubicEffect : public GrSingleTextureEffect { |
| 20 public: | 19 public: |
| 21 enum { | 20 enum { |
| 22 kFilterTexelPad = 2, // Given a src rect in texels to be filtered, this
number of | 21 kFilterTexelPad = 2, // Given a src rect in texels to be filtered, this
number of |
| 23 // surrounding texels are needed by the kernel in x
and y. | 22 // surrounding texels are needed by the kernel in x
and y. |
| 24 }; | 23 }; |
| 25 virtual ~GrBicubicEffect(); | 24 virtual ~GrBicubicEffect(); |
| 26 | 25 |
| 27 static const char* Name() { return "Bicubic"; } | |
| 28 const float* coefficients() const { return fCoefficients; } | 26 const float* coefficients() const { return fCoefficients; } |
| 29 | 27 |
| 30 typedef GrGLBicubicEffect GLProcessor; | 28 virtual const char* name() const SK_OVERRIDE { return "Bicubic"; } |
| 31 | 29 |
| 32 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 30 virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) cons
t SK_OVERRIDE; |
| 31 |
| 32 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; |
| 33 | 33 |
| 34 const GrTextureDomain& domain() const { return fDomain; } | 34 const GrTextureDomain& domain() const { return fDomain; } |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Create a simple filter effect with custom bicubic coefficients and option
al domain. | 37 * Create a simple filter effect with custom bicubic coefficients and option
al domain. |
| 38 */ | 38 */ |
| 39 static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficien
ts[16], | 39 static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficien
ts[16], |
| 40 const SkRect* domain = NULL) { | 40 const SkRect* domain = NULL) { |
| 41 if (NULL == domain) { | 41 if (NULL == domain) { |
| 42 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti
leMode, | 42 static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_Ti
leMode, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 GrTextureDomain fDomain; | 99 GrTextureDomain fDomain; |
| 100 | 100 |
| 101 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 101 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 102 | 102 |
| 103 static const SkScalar gMitchellCoefficients[16]; | 103 static const SkScalar gMitchellCoefficients[16]; |
| 104 | 104 |
| 105 typedef GrSingleTextureEffect INHERITED; | 105 typedef GrSingleTextureEffect INHERITED; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 #endif | 108 #endif |
| OLD | NEW |